Sunday, May 2, 2010

Re: Cake Console Baking Model displayField?

Baking views has nothing to do with it. Whether you bake the views or
not, Cake needs to know which field to display the record as. If
there's no displayField, it will likely just use the ID column.

When you display the data from a model with a foreign key, do you want
that field to show up as the foreign ID, or do you want Cake to
display the associated username/post title/category name/etc. instead?
When you're creating a new record, and you need to select an
associated record for a belongsTo relationship, do you want to see a
drop-down list full of ID numbers or something that is human-readable?

On Apr 28, 12:12 pm, Johnathan Iannotti <jo...@blueclover.com> wrote:
> Thanks John for your input!
>
> What is the point in declaring a displayField though if you are going to bake the views and it adds the columns anyway?
>
> Thanks,
> -John
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of John Andersen
> Sent: Wednesday, April 28, 2010 1:57 PM
> To: CakePHP
> Subject: Re: Cake Console Baking Model displayField?
>
> The CakePHP usually assumes that a table column named "name" or
> "title" is the display field, but if you don't have one, it will ask
> you what to do, as you have discovered :) So if you have a column that
> you would like to be displayed by default, then define one.
> Enjoy,
>    John
>
> On Apr 28, 9:50 pm, Johnathan Iannotti <jo...@blueclover.com> wrote:
> > I'm doing some baking on the console with 1.3 and perhaps I didn't setup my database correctly because I've never seen this message before:
>
> > A displayField could not be automatically detected would you like to choose one? (y/n)
>
> > I am then presented with a list of options from the database table I am trying to make my model from.  Is displayField supposed to be the primary key?  Any input would be appreciated, thanks!
>
> > -John
>
> [snip]
>
> 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 athttp://groups.google.com/group/cake-php?hl=en
>
> Homepage:http://www.blueclover.com |  Blog:http://www.blue-ings.com |  Twitter:http://twitter.com/bluecloverusa |  Facebook:http://www.facebook.com/blueclover | YouTube:http://www.youtube.com/user/bluecloverstudios| Join Our Mailing List:http://visitor.constantcontact.com/manage/optin?v=001ti8yLLtrqgo7unTQ...
>
> ---------------------------------------------------------------------------------------------------------------------
>
> This email transmission, including any attachments thereto, may contain information that is proprietary and confidential. The information is intended only for the use of the individual(s) or entity to whom this email has been addressed. If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information is strictly prohibited. If you have received this transmission in error, please let us know immediately and delete the email, including any attachments thereto, from your computer.
>
> 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 athttp://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: