Thanks Reggie, but the problem is that I have to use CakePHP v1.1.x, so I need a way to do that query in CakePHP or I need to do the query but it should return only the affected rows or a resource type which I can use it to know the affected rows, I don't want that the query return the data.
Thanks in advance, Regards On 1 abr, 18:12, Reggie Mason <tehtr...@gmail.com> wrote: > I don't know for CakePHP v1.1.x. However, if you use CakePHP v1.2.2 - > > -- Here is the User Model > <?php > class User extends AppModel { > public $name='User'; > public $hasOne=array('Page'=>array( > 'foreignKey'=>false, > 'type'=>'INNER', > 'conditions'=>array('Page.user_id=User.id'), > ) > ); > > }; > > -- And in the controller > <?php > / > *---------------------------------------------------------------------- > * file: example_controller.php > */ > class ExampleController extends AppController{ > public $name='Example'; > public $uses=array(); > public function index(){ > $this->User=ClassRegistry::init('User'); > $this->paginate=array('User'=>array('conditions'=> array ( > 'Page.status'=>1, > 'User.username'=>'tehtreag', > ), > 'order'=>'User.username', > 'fields'=>array( > 'User.id', > 'User.username', > 'Page.id', > ), > ) > ); > debug($this->paginate('User')); > $this->autoRender=false; > } > > That should work. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---