php - Property "CHasOneRelation.limit" is not defined -
how rid of error: property "chasonerelation.limit" not defined.
here relation method:
public function relations() { return array( 'documents' => array(self::has_many, 'document', 'dossier_id',), 'lastlogline' => array( self::has_one, 'logline ll', 'dossier_id', 'limit' => 1, 'order' => 'll.create_date desc'), 'lastmodifieduser' => array(self::has_one, 'user', 'lastmodified_user_id',), 'loglines' => array(self::has_many, 'logline', 'dossier_id',), 'priority' => array(self::has_one, 'priority', 'priority_id',), 'properties' => array(self::many_many, 'property', 'doe_dossier_has_property(dossier_id,property_id)',), 'state' => array( self::has_one, 'state', 'doe_logline(dossier_id,state_id) ll', 'limit' => 1, 'order' => 'll.create_date desc'), ); } then when go web page following error:
/vagrant/vendor/yiisoft/yii/framework/db/ar/cactiverecord.php(2011) 1999 * constructor. 2000 * @param string $name name of relation 2001 * @param string $classname name of related active record class 2002 * @param string $foreignkey foreign key relation 2003 * @param array $options additional options (name=>value). keys must property names of class. 2004 */ 2005 public function __construct($name,$classname,$foreignkey,$options=array()) 2006 { 2007 $this->name=$name; 2008 $this->classname=$classname; 2009 $this->foreignkey=$foreignkey; 2010 foreach($options $name=>$value) 2011 $this->$name=$value; 2012 } 2013 2014 /** 2015 * merges relation criteria specified dynamically. 2016 * @param array $criteria dynamically specified criteria 2017 * @param boolean $fromscope whether criteria merged scopes 2018 */ 2019 public function mergewith($criteria,$fromscope=false) 2020 { 2021 if($criteria instanceof cdbcriteria) 2022 $criteria=$criteria->toarray(); 2023 if(isset($criteria['select']) && $this->select!==$criteria['select']) how possible solve problem??
you cannot put limit on has 1 relation you've said has_one. chasonerelation knows needs find 1 relating record.
limit used on main query declare how many rows need.
do not put in table aliasses : 'logline ll', . alias lastlogline (the array definition).
Comments
Post a Comment