Monday, December 21, 2009

Re: bindModel, unbindModel, updateModel?

You can pass parameters to the find() method of a model for the limit,
page(/pagination), and order. You do not need to redeclare or change
the model definition on the fly. The model's paginate method uses find
() internally.

http://book.cakephp.org/view/73/Retrieving-Your-Data

On Dec 18, 7:21 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> Im no expert but I have my model function to get recent posts something like
> this $this->ModelName->getSomeData($id, $count, $order, ???);
>
> And in the model function 'count' => $count
>
> So depending on the controller / view I need 5 posts, other grab 10 and just
> change the count to what I need.
>
> Dave
>
>
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of Alan Asher
> Sent: December-18-09 6:52 PM
> To: cake-php@googlegroups.com
> Subject: bindModel, unbindModel, updateModel?
>
> Has anyone run across a function similar to bindModel and unbindModel which
> to me would be called updateModel()
>
> Basically, I've run across several situations where I just need to update
> the model's limit or ordering and finding that I have to use the bindModel
> and repeat everything that was in the model before.  
>
> I am a big fan of Don't Repeat Yourself, so an updateModel function would be
> super handy.
>
> I was thinking of just doing something like this
> $this->ModelName->belongsTo['OtherModelName']['order']='something new';
>
> Any thoughts???
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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
> cake-php+athttp://groups.google.com/group/cake-php?hl=en
>
> No virus found in this incoming message.
> Checked by AVG -www.avg.com
> Version: 9.0.716 / Virus Database: 270.14.102/2556 - Release Date: 12/18/09
> 04:05:00- Hide quoted text -
>
> - Show quoted text -

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: