updateAll issue

Hi

I'm trying to uses updateAll to change some records parent (foreign key). But the update doesn't update any records:



ImgdbImg::model() -> updateAll(array('parent' => $this -> parent), 'parent = :parent', array(':parent' => $this -> id));


To me, this should work fine, basically this is just updating records where a parent = x to a new parent number which links to another table but the records do not get updated, I've checked the the keys and all its correct.

is confuddled

Did you check the generated SQL? Is that what you want to do?

How do I ge the generated SQL code?  ???

Turn on logging (check the guide) without setting any level and category log filters in a log route.

It seems that if in your condition you have a bind that has the same name as an attribute to be updated, the update fails, changing the above code to:



<?php


ImgdbImg::model() -> updateAll(array('parent' => $this -> parent), 'parent = :id', array(':id' => $this -> id));


This code completed the update as expected where as the code in my first post does not.

Chris