My bevaviours that worked fine at 1.1.0 is not working in 1.1.1. I tried both - runtime and inline ways - no success.
p.s.: behaviour for beforeFind. Looks like function is called, but criteria overrides somewhere.
My bevaviours that worked fine at 1.1.0 is not working in 1.1.1. I tried both - runtime and inline ways - no success.
p.s.: behaviour for beforeFind. Looks like function is called, but criteria overrides somewhere.
Can you give some code to check?
maybe behavior, but not behavio[size=“5”]u[/size]r?! , so
public function behaviors(){
return array(....);
}
just use simplest test and u will reproduce. But anyway, here is ‘example’:
class UsersAuctionBehavior extends CActiveRecordBehavior {
public function beforeFind($event) {
print "!!!!";
if($this->getEnabled()) {
$this->Owner
->getDbCriteria()
->addCondition('t.cid = ' . Yii::app()->params['auction']['web_user_id']);
}
parent::beforeFind($event);
}
}
and here is attachment, that u can put somewhere inside of any action of controller:
Request::model()->attachBehavior(‘AuctionUsersOnly’, new UsersAuctionBehavior);
U will see “!!!!” if u will call that action, but if u will check SQL - no such condition. I just rolledback for Yii 1.1.0 and everything works fine, so at last version of Yii there were some changes without any mention at changelog.txt
P.S.: ‘Request’ - common active record model.
very funny. btw behaviour is correct word, if u hadn’t known it.
Luckly, we didn’t use any new features from 1.1.1. so we rolledback at production server without any problems.
"Behavior" is same correct word as "behaviour"!
And in behavior you can’t access to criteria (check CActiveRecord.php):
private function query($criteria,$all=false)
{
$this->applyScopes($criteria);
if(empty($criteria->with))
{
if(!$all)
$criteria->limit=1;
$this->beforeFind();
$command=$this->getCommandBuilder()->createFindCommand($this->getTableSchema(),$criteria);
return $all ? $this->populateRecords($command->queryAll()) : $this->populateRecord($command->queryRow());
}
else
return $this->with($criteria->with)->query($criteria,$all);
}
at first post for this topic, i wrote that everything works fine with 1.1.0 and no success with 1.1.1 I don’t compare for diff each release, i read changelog.txt and decide to switch for new version or not. Right now i haven’t time to check for changes each core file of framework for changes. Luckly, rollback in our case was easy and without real pain. But new behaviour of behaviours (lol ) was surprise for us.
not sure. But CVarDump for criteria shows that condition is overwriting somewhere.
Yes, seems it’s the same issue.