| @@ 684-695 (lines=12) @@ | ||
| 681 | * @param ODM $odm ODM component, global container will be called if not instance provided. |
|
| 682 | * @event created() |
|
| 683 | */ |
|
| 684 | public static function create($fields = [], ODM $odm = null) |
|
| 685 | { |
|
| 686 | /** |
|
| 687 | * @var DocumentEntity $document |
|
| 688 | */ |
|
| 689 | $document = new static([], null, $odm); |
|
| 690 | ||
| 691 | //Forcing validation (empty set of fields is not valid set of fields) |
|
| 692 | $document->setFields($fields)->dispatch('created', new EntityEvent($document)); |
|
| 693 | ||
| 694 | return $document; |
|
| 695 | } |
|
| 696 | ||
| 697 | /** |
|
| 698 | * Called by ODM with set of loaded fields. Must return name of appropriate class. |
|
| @@ 850-861 (lines=12) @@ | ||
| 847 | * @param ORM $orm ORM component, global container will be called if not instance provided. |
|
| 848 | * @event created() |
|
| 849 | */ |
|
| 850 | public static function create($fields = [], ORM $orm = null) |
|
| 851 | { |
|
| 852 | /** |
|
| 853 | * @var RecordEntity $record |
|
| 854 | */ |
|
| 855 | $record = new static([], false, $orm); |
|
| 856 | ||
| 857 | //Forcing validation (empty set of fields is not valid set of fields) |
|
| 858 | $record->setFields($fields)->dispatch('created', new EntityEvent($record)); |
|
| 859 | ||
| 860 | return $record; |
|
| 861 | } |
|
| 862 | ||
| 863 | /** |
|
| 864 | * Change record loaded state. |
|