| @@ 685-696 (lines=12) @@ | ||
| 682 | * @param ODM $odm ODM component, global container will be called if not instance provided. |
|
| 683 | * @event created() |
|
| 684 | */ |
|
| 685 | public static function create($fields = [], ODM $odm = null) |
|
| 686 | { |
|
| 687 | /** |
|
| 688 | * @var DocumentEntity $document |
|
| 689 | */ |
|
| 690 | $document = new static([], null, $odm); |
|
| 691 | ||
| 692 | //Forcing validation (empty set of fields is not valid set of fields) |
|
| 693 | $document->setFields($fields)->dispatch('created', new EntityEvent($document)); |
|
| 694 | ||
| 695 | return $document; |
|
| 696 | } |
|
| 697 | ||
| 698 | /** |
|
| 699 | * Called by ODM with set of loaded fields. Must return name of appropriate class. |
|
| @@ 817-828 (lines=12) @@ | ||
| 814 | * @param ORM $orm ORM component, global container will be called if not instance provided. |
|
| 815 | * @event created() |
|
| 816 | */ |
|
| 817 | public static function create($fields = [], ORM $orm = null) |
|
| 818 | { |
|
| 819 | /** |
|
| 820 | * @var RecordEntity $record |
|
| 821 | */ |
|
| 822 | $record = new static([], false, $orm); |
|
| 823 | ||
| 824 | //Forcing validation (empty set of fields is not valid set of fields) |
|
| 825 | $record->setFields($fields)->dispatch('created', new EntityEvent($record)); |
|
| 826 | ||
| 827 | return $record; |
|
| 828 | } |
|
| 829 | ||
| 830 | /** |
|
| 831 | * Change record loaded state. |
|