public static function updateEntityFromArray($entity, array $data)
    {
        foreach ($data as $field => $value) {
            $method = 'set' . self::formatStringToMethodName($field);
            if (method_exists($entity, $method)) {
                $entity->$method($value);
            }
        }

        return $entity;
    }
public static function updateEntityFromArray($entity, array $data)
    {
        foreach ($data as $field => $value) {
            $method = 'set' . self::formatStringToMethodName($field);
            if (method_exists($entity, $method)) {
                $entity->$method($value);
            }
        }

        return $entity;
    }
public static function updateEntityFromArray ( $ entity , array $ data ) { foreach ( $ data as $ field => $ value ) { $ method = 'set' . self :: formatStringToMethodName ( $ field ) ; if ( method_exists ( $ entity , $ method ) ) { $ entity -> $ method ( $ value ) ; } } return $ entity ; }
Updates Entity from data calling setters based
on data keys
@param object $entity
@param array $data
@return mixed
Updates Entity from data calling setters based on data keys