Had the same problem, don't know why they didn't add it, but I added it in my code and it works perfect! I hope they'll include it in one of the next releases.
On Sep 11, 9:41 am, Cosmin Paul <[email protected]> wrote: > I found this: > > https://trac.cakephp.org/ticket/5666 > > Why it is not included in latest table version, have any idea ? > > Thanks for the code ! > > > > On Thu, Sep 10, 2009 at 6:51 PM, grigri <[email protected]> wrote: > > > Try this: > > > class YourModel extends AppModel { > > // ... > > > function hasField($name) { > > if ($name === 'initial_monthly_payment') { > > return true; > > } > > return parent::hasField($name); > > } > > > function beforeFilter($query) { > > if (!empty($query['order'])) { > > foreach($query['order'] as $i => $a) { > > if (!is_array($a)) { > > continue; > > } > > foreach($a as $k => $v) { > > $alias = $this->alias; > > $field = $k; > > if (strpos($field, '.') !== false) { > > list($alias, $field) = > > explode('.', $field, 2); > > } > > if ($alias == $this->alias && $field > > == > > 'initial_monthly_payment') { > > $query['order'][$i] = > > 'RAND()'; > > } > > } > > } > > return $query; > > } > > } > > } > > > hth > > grigri > > > On Sep 10, 2:36 pm, Cosmin Paul <[email protected]> wrote: > >> Because I use the query to mysql for some math. > >> CakePhp dose't let me use > >> $paginator->sort('Initial Monthly repayments','initial_monthly_payment'); > >> <CODE> > >> <php> > >> $initial_monthly_payment = MATH FORMULAS; > >> </php>. > >> <SQL FIELDS QUERY> > >> . > >> . > >> $initial_monthly_payment.'` as `initial_monthly_payment' > >> . > >> . > >> </SQL FIELDS QUERY> > >> </CODE> > > >> I don't have 'initial_monthly_payment' as a field in the table. > > >> Haw can I fix this ? > > >> Thanks for the time! > > -- > Paul-Cosmin Constandachi > Tel: 0723.46.46.42 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
