Graham
Graham

Reputation: 1155

cakePHP Table Field naming convention

So it seems that cakePHP tables need a field called "name" or else the id number is displayed while testing out table relationships in the scaffold. Is there a way around this? instead of 'id' 'name' 'last_name' in my table, I want 'id' 'first_name' 'last_name'. I have to have a "name" field for every table in order to display the proper data...

Upvotes: 0

Views: 1435

Answers (1)

timdev
timdev

Reputation: 62894

Can't you just set the $displayField property on your model class, just like the manual says to?

<?php
class User extends AppModel 
{    
    var $name = 'User';
    var $displayField = 'first_name';
}
?>

Upvotes: 3

Related Questions