Thursday, August 26, 2010

Re: Does every model need a "name" field? Why?

Not strictly accurate - you do not need to have either a name or title field in your table, but they have their uses. Cake can use a 'name' or 'title' field to automatically populate lists and such. Having said that, you can override it with var $displayField in your model. See: http://book.cakephp.org/view/1014/Titles for more info.

I prefer to stick to a name field as Cake drives convention.

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 26 Aug 2010, at 09:23, psybear83 wrote:

> Hi all
>
> I'm just digging into CakePHP and continue an application of my
> previous co-worker. He told me that every model needs a "name" field
> in the database. Why's that? I did a search on Google but could't find
> an answer...
>
> Thanks
> Josh
>
> 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

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: