protected function mapEntityToObject(array $mapping, $entity, \stdClass $data)
    {
        foreach ($mapping as $dataProperty => $map) {
            $value = null;
            if (is_string($map)) {
                // Retrieve the entity getter
                $getter = $this->getEntityGetter($entity, $map);

                // Inject data into object
                $value = call_user_func([$entity, $getter]);
            } elseif (is_callable($map)) {
                // Call the defined function
                $value = call_user_func($map, $entity);
            }

            $data->{$dataProperty} = $value;
        }

        return $data;
    }
protected function mapEntityToObject(array $mapping, $entity, \stdClass $data)
    {
        foreach ($mapping as $dataProperty => $map) {
            $value = null;
            if (is_string($map)) {
                // Retrieve the entity getter
                $getter = $this->getEntityGetter($entity, $map);

                // Inject data into object
                $value = call_user_func([$entity, $getter]);
            } elseif (is_callable($map)) {
                // Call the defined function
                $value = call_user_func($map, $entity);
            }

            $data->{$dataProperty} = $value;
        }

        return $data;
    }
protected function mapEntityToObject ( array $ mapping , $ entity , \ stdClass $ data ) { foreach ( $ mapping as $ dataProperty => $ map ) { $ value = null ; if ( is_string ( $ map ) ) { // Retrieve the entity getter $ getter = $ this -> getEntityGetter ( $ entity , $ map ) ; // Inject data into object $ value = call_user_func ( [ $ entity , $ getter ] ) ; } elseif ( is_callable ( $ map ) ) { // Call the defined function $ value = call_user_func ( $ map , $ entity ) ; } $ data -> { $ dataProperty } = $ value ; } return $ data ; }
Maps entity properties into raw object.

Mapping array format :
- key   : the name of the property to create in the \stdClass
- value : either an entity property (accessible with a getter) or a callback

@param array     $mapping
@param mixed     $entity
@param \stdClass $data

@return \stdClass the updated raw object
Maps entity properties into raw object .