private function createEntities(array $data, bool $filter = true): array
    {
        $result = [];
        foreach ($data as $item) {
            if ($item instanceof CompositableInterface) {
                $this->assertSupported($item);

                //Always clone to detach from original value
                $result[] = clone $item;
            } else {
                $result[] = $this->odm->make($this->class, $item, $filter);
            }
        }

        return $result;
    }
private function createEntities(array $data, bool $filter = true): array
    {
        $result = [];
        foreach ($data as $item) {
            if ($item instanceof CompositableInterface) {
                $this->assertSupported($item);

                //Always clone to detach from original value
                $result[] = clone $item;
            } else {
                $result[] = $this->odm->make($this->class, $item, $filter);
            }
        }

        return $result;
    }
private function createEntities ( array $ data , bool $ filter = true ) : array { $ result = [ ] ; foreach ( $ data as $ item ) { if ( $ item instanceof CompositableInterface ) { $ this -> assertSupported ( $ item ) ; //Always clone to detach from original value $ result [ ] = clone $ item ; } else { $ result [ ] = $ this -> odm -> make ( $ this -> class , $ item , $ filter ) ; } } return $ result ; }
Instantiate every entity in composition.

@param array $data
@param bool  $filter

@return CompositableInterface[]

@throws CompositorException
Instantiate every entity in composition .