protected function getFromDataMapper(string $functionName, array $args = [])
    {
        $entities = $this->dataMapper->$functionName(...$args);

        if (is_array($entities)) {
            // Passing by reference here is important because that reference may be updated in the unit of work
            foreach ($entities as &$entity) {
                if ($entity !== null) {
                    $this->unitOfWork->getEntityRegistry()->registerEntity($entity);
                }
            }
        } elseif ($entities !== null) {
            $this->unitOfWork->getEntityRegistry()->registerEntity($entities);
        }

        return $entities;
    }
protected function getFromDataMapper(string $functionName, array $args = [])
    {
        $entities = $this->dataMapper->$functionName(...$args);

        if (is_array($entities)) {
            // Passing by reference here is important because that reference may be updated in the unit of work
            foreach ($entities as &$entity) {
                if ($entity !== null) {
                    $this->unitOfWork->getEntityRegistry()->registerEntity($entity);
                }
            }
        } elseif ($entities !== null) {
            $this->unitOfWork->getEntityRegistry()->registerEntity($entities);
        }

        return $entities;
    }
protected function getFromDataMapper ( string $ functionName , array $ args = [ ] ) { $ entities = $ this -> dataMapper -> $ functionName ( ... $ args ) ; if ( is_array ( $ entities ) ) { // Passing by reference here is important because that reference may be updated in the unit of work foreach ( $ entities as & $ entity ) { if ( $ entity !== null ) { $ this -> unitOfWork -> getEntityRegistry ( ) -> registerEntity ( $ entity ) ; } } } elseif ( $ entities !== null ) { $ this -> unitOfWork -> getEntityRegistry ( ) -> registerEntity ( $ entities ) ; } return $ entities ; }
Performs a get query on the data mapper and adds any results as managed entities to the unit of work

@param string $functionName The name of the function to call in the data mapper
@param array $args The list of arguments to pass into the data mapper
@return object|object[] The entity or list of entities
@throws OrmException Thrown if there was an error getting the entity(ies)
Performs a get query on the data mapper and adds any results as managed entities to the unit of work