Code Duplication    Length = 12-12 lines in 2 locations

source/Spiral/ORM/RecordEntity.php 1 location

@@ 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.

source/Spiral/ODM/DocumentEntity.php 1 location

@@ 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.