Saturday, September 25, 2010

how to get the reference of $this->model id ref in model class for virutal field

Hi,

how to get the reference of $this->model id ref in model class for
virutal field

using cakephp version 1.3.1

i used virtual field is to get the sum of related amount for every id
of studio_id

var $virtualFields = array('balance' => 'select sum(j.amount) -
( ( (select sum(p.payment) from payments p where p.order_id in
( select id from orders o where o.studio_id = 10 ) ) +
( select sum(discount) from orders o where o.studio_id = 10 ) ) ) as
studioBal
from jobs j where j.order_id in ( select id from orders o where
o.studio_id = 10 )') ;

Above query is working fine for static given id ex: 10 here and now
only i want to know
how can i give any variable to give ref of self model.id instead of
static id i given above.

i read some where and read $__cakeID__$ , i tried but not worked

i want to compute this virtual column result for every id record of
$this model


Regards,

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: