$displayField – title override in CakePHP

Had a problem this morning, I’m using  non standard title field in my table (I’m experimenting with different ways of making a db multilingual).  CakePHPexpects to see a field called “title” to populate drop downs etc when using $belongsTo – it’s one of Cake’s automagic field conventions.  To override this however, you can in the model specify the field you would like to use e.g.

var $displayField = ‘yourTitleField’;

Inspired by this query on the CakePHP google group.

Problem with hasAndBelongsToMany association – CakePHP | Google Groups:

Bookmark and Share

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)