PHP 인터페이스 Mongolid\Model\PolymorphableInterface

See the docblock of the polymorph method for more details.
또한 보기: Mongolid\DataMapper\EntityAssembler
파일 보기 프로젝트 열기: leroy-merlin-br/mongolid

공개 메소드들

메소드 설명
polymorph ( ) : mixed The polymorphic method is something that may be implemented in order to make a model polymorphic. For example: You may have three models within the same collection: Content, ArticleContent and VideoContent.

메소드 상세

polymorph() 공개 메소드

By implementing the polymorph method it is possible to retrieve an ArticleContent or a VideoContent object object by simply querying within the Content model using first, find, where or all. Example: public function polymorph() { if ($this->video != null) { $obj = new VideoContent; $obj->fill($this->attributes); return $obj; } else { return $this; } } In the example above, if you call Content::first() and the content returned have the key video set, then the object returned will be a VideoContent instead of a Content.
public polymorph ( ) : mixed
리턴 mixed