| @@ 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. |
|
| @@ 821-832 (lines=12) @@ | ||
| 818 | * @param ORM $orm ORM component, global container will be called if not instance provided. |
|
| 819 | * @event created() |
|
| 820 | */ |
|
| 821 | public static function create($fields = [], ORM $orm = null) |
|
| 822 | { |
|
| 823 | /** |
|
| 824 | * @var RecordEntity $record |
|
| 825 | */ |
|
| 826 | $record = new static([], false, $orm); |
|
| 827 | ||
| 828 | //Forcing validation (empty set of fields is not valid set of fields) |
|
| 829 | $record->setFields($fields)->dispatch('created', new EntityEvent($record)); |
|
| 830 | ||
| 831 | return $record; |
|
| 832 | } |
|
| 833 | ||
| 834 | /** |
|
| 835 | * Change record loaded state. |
|