当前位置: 首页>>代码示例>>PHP>>正文


PHP Doctrine_Record::__call方法代码示例

本文整理汇总了PHP中Doctrine_Record::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Record::__call方法的具体用法?PHP Doctrine_Record::__call怎么用?PHP Doctrine_Record::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine_Record的用法示例。


在下文中一共展示了Doctrine_Record::__call方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getValue

 /**
  * Extract the value of the field from a record.
  * @param Doctrine_Record $record
  * @return mixed
  */
 public function getValue($record)
 {
     if (!$this->getField()) {
         throw new IllegalStateException('Not field defined por relation ' . $this->getName());
     }
     $getter = 'get' . ucfirst($this->getName());
     return $this->getField()->getValue($record->__call($getter, array()));
 }
开发者ID:BGCX261,项目名称:zoorestaurant-svn-to-git,代码行数:13,代码来源:AsyncSearchRelationField.class.php

示例2: __call

 /**
  * Provides getter and setter methods.
  *
  * @param  string $method    The method name
  * @param  array  $arguments The method arguments
  *
  * @return mixed The returned value of the called method
  */
 public function __call($method, $arguments)
 {
     $failed = false;
     try {
         if (in_array($verb = substr($method, 0, 3), array('set', 'get'))) {
             $name = substr($method, 3);
             $table = $this->getTable();
             if ($table->hasRelation($name)) {
                 $entityName = $name;
             } else {
                 if ($table->hasField($fieldName = $table->getFieldName($name))) {
                     $entityNameLower = strtolower($fieldName);
                     if ($table->hasField($entityNameLower)) {
                         $entityName = $entityNameLower;
                     } else {
                         $entityName = $fieldName;
                     }
                 } else {
                     $underScored = $table->getFieldName(sfInflector::underscore($name));
                     if ($table->hasField($underScored) || $table->hasRelation($underScored)) {
                         $entityName = $underScored;
                     } else {
                         if ($table->hasField(strtolower($name)) || $table->hasRelation(strtolower($name))) {
                             $entityName = strtolower($name);
                         } else {
                             $camelCase = $table->getFieldName(sfInflector::camelize($name));
                             $camelCase = strtolower($camelCase[0]) . substr($camelCase, 1, strlen($camelCase));
                             if ($table->hasField($camelCase) || $table->hasRelation($camelCase)) {
                                 $entityName = $camelCase;
                             } else {
                                 $entityName = $underScored;
                             }
                         }
                     }
                 }
             }
             return call_user_func_array(array($this, $verb), array_merge(array($entityName), $arguments));
         } else {
             $failed = true;
         }
     } catch (Exception $e) {
         $failed = true;
     }
     if ($failed) {
         try {
             return parent::__call($method, $arguments);
         } catch (Doctrine_Record_UnknownPropertyException $e2) {
         }
         if (isset($e) && $e) {
             throw $e;
         } else {
             if (isset($e2) && $e2) {
                 throw $e2;
             }
         }
     }
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:65,代码来源:sfDoctrineRecord.class.php

示例3: getValue

 /**
  * Extract the value of the field from a record.
  * @param Doctrine_Record $record
  * @return mixed
  */
 public function getValue($record)
 {
     $getter = 'get' . ucfirst($this->getName());
     return $record->__call($getter, array());
 }
开发者ID:BGCX261,项目名称:zoorestaurant-svn-to-git,代码行数:10,代码来源:AsyncRecordFinderField.class.php

示例4: __call

 public function __call($method, $arguments)
 {
     try {
         if (in_array($verb = substr($method, 0, 3), array('set', 'get'))) {
             $name = substr($method, 3);
             $table = $this->getTable();
             if ($table->hasRelation($name)) {
                 $entityName = $name;
             } else {
                 if ($table->hasField($fieldName = $table->getFieldName($name))) {
                     $entityName = strtolower($fieldName);
                 } else {
                     $underScored = $table->getFieldName(sfInflector::underscore($name));
                     if ($table->hasField($underScored)) {
                         $entityName = $underScored;
                     } else {
                         if ($table->hasField(strtolower($name))) {
                             $entityName = strtolower($name);
                         } else {
                             $entityName = $underScored;
                         }
                     }
                 }
             }
             return call_user_func_array(array($this, $verb), array_merge(array($entityName), $arguments));
         } else {
             return parent::__call($method, $arguments);
         }
     } catch (Exception $e) {
         return parent::__call($method, $arguments);
     }
 }
开发者ID:googlecode-mirror,项目名称:orso,代码行数:32,代码来源:sfDoctrineRecord.class.php

示例5: __call

 /**
  * This magic __call is used to provide propel style accessors to Doctrine models
  *
  * @param string $m 
  * @param string $a 
  * @return void
  */
 public function __call($m, $a)
 {
     try {
         $verb = substr($m, 0, 3);
         if ($verb == 'set' || $verb == 'get') {
             $camelColumn = substr($m, 3);
             // If is a relation
             if (in_array($camelColumn, array_keys($this->getTable()->getRelations()))) {
                 $column = $camelColumn;
             } else {
                 $column = sfInflector::underscore($camelColumn);
             }
             if ($verb == 'get') {
                 return $this->get($column);
             } else {
                 return $this->set($column, $a[0]);
             }
         } else {
             return parent::__call($m, $a);
         }
     } catch (Exception $e) {
         return parent::__call($m, $a);
     }
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:31,代码来源:sfDoctrineRecord.class.php


注:本文中的Doctrine_Record::__call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。