protected function hydrate($entity, array $arguments)
    {
        foreach ($arguments as $argument => $value) {
            if (is_array($value)) {
                if(isset($this->em->getClassMetadata(get_class($entity))->associationMappings[$argument])) {
                    $value = $this->hydrateRelation($entity, $argument, $value);
                }
            }
            $entity->{"set".Inflector::camelize($argument)}($value);
        }

        return $entity;
    }
protected function hydrate($entity, array $arguments)
    {
        foreach ($arguments as $argument => $value) {
            if (is_array($value)) {
                if(isset($this->em->getClassMetadata(get_class($entity))->associationMappings[$argument])) {
                    $value = $this->hydrateRelation($entity, $argument, $value);
                }
            }
            $entity->{"set".Inflector::camelize($argument)}($value);
        }

        return $entity;
    }
protected function hydrate ( $ entity , array $ arguments ) { foreach ( $ arguments as $ argument => $ value ) { if ( is_array ( $ value ) ) { if ( isset ( $ this -> em -> getClassMetadata ( get_class ( $ entity ) ) -> associationMappings [ $ argument ] ) ) { $ value = $ this -> hydrateRelation ( $ entity , $ argument , $ value ) ; } } $ entity -> { "set" . Inflector :: camelize ( $ argument ) } ( $ value ) ; } return $ entity ; }
Hydrate array to entity object

@param $entity
@param array $arguments
@return Entity
@throws \Doctrine\ORM\Mapping\MappingException
Hydrate array to entity object