Thank you for your replies. I use the new 1.3 virtual field now, and it works perfectly!
On 13 apr, 01:27, jacmoe <[email protected]> wrote: > I had the same problem yesterday, and had to manually massage the data > into a data array, but that was because I had (and still have) three > computed fields. > But I believe that you can use Teknoid's advice > here:http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-field... > Override your models find function and your data should be good for > pagination. :) > > If not, you just need to re-arrange the array yourself. > > On Apr 12, 5:23 pm, Alterego <[email protected]> wrote: > > > Hi there, > > > I have a small issue that kept me busy for a whole day now. > > > I want to sort on a psuedofield, so I use this code in the controller: > > > function index() { > > $this->Contract->recursive = 0; > > > $this->paginate = array( > > 'fields' => array('*', 'COALESCE(price_month_action, > > price_month_regular) AS price_month_least'), > > 'limit' => 500, > > 'order' => array('price_month_least' => 'asc')); > > > $this->set('contracts', $this->paginate()); > > } > > > This works, but the 'price_month_least' value is outside of the > > Contract array + sorting doesn't work when I pass the sorting > > arguments in the URL like so: /contracts/index/sort:price_month_least/ > > > I tried to add the pseudofield in the beforeFind in the Model, but > > that didn't solve the problem. Could anybody help me out? > > > Thank you. 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using "remove me" as the subject.
