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


PHP CActiveRecord::__call方法代码示例

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


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

示例1: __call

 public function __call($name, $arguments)
 {
     $flags = $this->cachedFlags();
     if (isset($flags[strtolower($name)])) {
         return $this->withFlag($name);
     }
     return parent::__call($name, $arguments);
 }
开发者ID:fduch2k,项目名称:yii-flagged-activerecord,代码行数:8,代码来源:TSFlaggedActiveRecord.php

示例2: __call

 public function __call($name, $args)
 {
     $this->initRelation();
     if (isset($this->__relations[$name])) {
         if (is_numeric($args[0])) {
             $this->__page[$name] = $args[0];
             if (count($args) == 2 && is_numeric($args[1])) {
                 $this->__pageSize[$name] = $args[1];
             }
             $criteria = $this->relPagingCriteria($name);
         } else {
             if (is_array($args[0])) {
                 $opt = $args[0];
                 $setRelPaging = false;
                 if (isset($opt['page'])) {
                     $this->__page[$name] = $opt['page'];
                     unset($opt['page']);
                     $setRelPaging = true;
                 }
                 if (isset($opt['pageSize'])) {
                     $this->__pageSize[$name] = $opt['pageSize'];
                     unset($opt['pageSize']);
                 }
                 if ($setRelPaging) {
                     $criteria = $this->relPagingCriteria($name);
                     $criteria = array_merge($criteria, $opt);
                 } else {
                     $criteria = $opt;
                 }
             }
         }
         $this->loadRelation($name, @$criteria);
         $this->applyRelChange($name);
         return $this->__relations[$name];
     } else {
         return parent::__call($name, $args);
     }
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:38,代码来源:ActiveRecord.php

示例3: __call

 /**
  * Added an override to __call to create the addRELATION() and removeRELATION() methods
  * PHP setter magic method.
  * @param string $name property name
  * @param mixed $value property value
  */
 public function __call($name, $parameters)
 {
     if (strpos($name, 'add') === 0) {
         $relation = lcfirst(substr($name, 3));
         if ($this->getManyManyRelation($relation)) {
             if (!empty($parameters)) {
                 return $this->addRelated($relation, $parameters[0]);
             } elseif (count($parameters) > 1) {
                 throw new CException('Too many parameters.');
             } else {
                 throw new CException('You must pass in a related model to add.');
             }
         }
     }
     if (strpos($name, 'remove') === 0) {
         $relation = lcfirst(substr($name, 6));
         if ($this->getManyManyRelation($relation)) {
             if (!empty($parameters)) {
                 return $this->removeRelated($relation, $parameters[0]);
             } elseif (count($parameters) > 1) {
                 throw new CException('Too many parameters.');
             } else {
                 throw new CException('You must pass in a related model to add.');
             }
         }
     }
     return parent::__call($name, $parameters);
 }
开发者ID:narwold,项目名称:Small-Potatoes,代码行数:34,代码来源:SAdvancedActiveRecord.php


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