protected function doConvertObjectToArray($object)
 {
     if (isset($this->options['convert']) || method_exists($object, 'toParams')) {
         return parent::doConvertObjectToArray($object);
     }
     $className = $this->options['model'];
     $parameters = array();
     foreach ($this->getRealVariables() as $variable) {
         $parameters[$variable] = $object->get($variable);
     }
     return $parameters;
 }
 protected function doConvertObjectToArray($object)
 {
     if (isset($this->options['convert']) || method_exists($object, 'toParams')) {
         return parent::doConvertObjectToArray($object);
     }
     $className = $this->options['model'];
     $parameters = array();
     foreach ($this->getRealVariables() as $variable) {
         try {
             $method = 'get' . call_user_func(array($className, 'translateFieldName'), $variable, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME);
         } catch (Exception $e) {
             $method = 'get' . sfInflector::camelize($variable);
         }
         $parameters[$variable] = $object->{$method}();
     }
     return $parameters;
 }
Example #3
0
 protected function doConvertObjectToArray($object)
 {
     if (isset($this->options['convert']) || method_exists($object, 'toParams')) {
         return parent::doConvertObjectToArray($object);
     }
     $parameters = array();
     foreach ($this->getRealVariables() as $variable) {
         try {
             $parameters[$variable] = $object->{$variable};
         } catch (Exception $e) {
             try {
                 $method = 'get' . sfInflector::camelize($variable);
                 $parameters[$variable] = $object->{$method}();
             } catch (Exception $e) {
             }
         }
     }
     return $parameters;
 }