CakePHP: Display name instead of id in linked tables





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am new developer in CakePHP and PHP.




I have 2 tables: Tasks, Users and Customers.




Among others Tasks has this foreign key linked to Users table: Assigned_from and the foreign key Customer_id linked to Customers table.



So in UsersTable.php I have inserted these lines:





Function initialize :



$this->hasMany('TasksFrom', [
'foreignKey' => 'assigned_From',
'className' => 'Tasks'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'TasksFrom'));




Accordingly in TasksTable.php :
Function initialize :



$this->belongsTo('UsersFrom', [
'foreignKey' => 'assigned_from',
'className' => 'Users'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'UsersFrom'));




And in CustomersTable.php:



Function Initialize:



$this->hasMany('Tasks', [
'foreignKey' => 'customer_id'
]);


So in order to show this information in the User view I have added these lines in UsersController.php :



public function view($id = null)
{
$user = $this->Users->get($id,[
'contain' => ['TasksTo', 'TasksFrom', 'TasksBy']
]);
$this->set('user', $user);
}


How I can modify my code in order to display User Name instead of User Id when accessing echo $task->assigned_from and Customer name instead of Customer_id when accessing echo $task->customer_id?



Here is the current code in users/view.ctp:



foreach ($user->tasks_to as $task) {


?>
<tr id="<?php echo $task['id'] ?>">
<td><?php echo $task->priority ?></td>
<td><?php echo $task->name ?></td>
<td><?php echo $task->instructions ?></td>
<td><?php echo $task->assigned_from ?></td> //It displays user id, I want to display user name
<td><?php echo $task->customer_id ?></td> //Display Customer name instead of Customer_id
<td><?php echo $task->progress ?></td>
</tr>
<?php } ?>


Debug output debug($user->tasks_to):



(int) 1 => object(AppModelEntityTask) {

'id' => (int) 2,
'name' => 'Design Logo for Website',
'task_type_id' => (int) 1,
'role_id' => (int) 5,
'instructions' => 'Design logo for website.com website, (instructions)',
'date_start' => object(CakeI18nFrozenDate) {

'time' => '2018-12-20T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'date_end' => object(CakeI18nFrozenDate) {

'time' => '2018-12-22T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'total_minutes' => (int) 120,
'assigned_to' => (int) 1,
'assigned_from' => (int) 1,
'customer_id' => (int) 1,
'progress' => null,
'progress_weight_id' => (int) 2,
'priority' => (int) 1,
'status_id' => (int) 2,
'shared_folder_path' => 'path_to_logo_files',
'created_by' => null,
'created_date' => null,
'price' => (float) 0,
'cost' => (float) 0,
'project_status' => object(AppModelEntityProjectStatus) {

'id' => (int) 2,
'status' => 'Running',
'[new]' => false,
'[accessible]' => [
'status' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'ProjectStatus'

},
'[new]' => false,
'[accessible]' => [
'name' => true,
'task_type_id' => true,
'role_id' => true,
'instructions' => true,
'date_start' => true,
'date_end' => true,
'total_minutes' => true,
'assigned_to' => true,
'assigned_from' => true,
'customer_id' => true,
'progress' => true,
'progress_weight_id' => true,
'priority' => true,
'status_id' => true,
'shared_folder_path' => true,
'created_by' => true,
'created_date' => true,
'price' => true,
'cost' => true,
'task_type' => true,
'role' => true,
'users_to' => true,
'users_from' => true,
'users_by' => true,
'user' => true,
'customer' => true,
'progress_weight_label' => true,
'project_status' => true,
'transactions' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'TasksTo'

}
]









share|improve this question

























  • is this typo ? 'foreignKey' => 'assigned_From', _F... ?

    – Salines
    Jan 7 at 15:54


















0















I am new developer in CakePHP and PHP.




I have 2 tables: Tasks, Users and Customers.




Among others Tasks has this foreign key linked to Users table: Assigned_from and the foreign key Customer_id linked to Customers table.



So in UsersTable.php I have inserted these lines:





Function initialize :



$this->hasMany('TasksFrom', [
'foreignKey' => 'assigned_From',
'className' => 'Tasks'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'TasksFrom'));




Accordingly in TasksTable.php :
Function initialize :



$this->belongsTo('UsersFrom', [
'foreignKey' => 'assigned_from',
'className' => 'Users'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'UsersFrom'));




And in CustomersTable.php:



Function Initialize:



$this->hasMany('Tasks', [
'foreignKey' => 'customer_id'
]);


So in order to show this information in the User view I have added these lines in UsersController.php :



public function view($id = null)
{
$user = $this->Users->get($id,[
'contain' => ['TasksTo', 'TasksFrom', 'TasksBy']
]);
$this->set('user', $user);
}


How I can modify my code in order to display User Name instead of User Id when accessing echo $task->assigned_from and Customer name instead of Customer_id when accessing echo $task->customer_id?



Here is the current code in users/view.ctp:



foreach ($user->tasks_to as $task) {


?>
<tr id="<?php echo $task['id'] ?>">
<td><?php echo $task->priority ?></td>
<td><?php echo $task->name ?></td>
<td><?php echo $task->instructions ?></td>
<td><?php echo $task->assigned_from ?></td> //It displays user id, I want to display user name
<td><?php echo $task->customer_id ?></td> //Display Customer name instead of Customer_id
<td><?php echo $task->progress ?></td>
</tr>
<?php } ?>


Debug output debug($user->tasks_to):



(int) 1 => object(AppModelEntityTask) {

'id' => (int) 2,
'name' => 'Design Logo for Website',
'task_type_id' => (int) 1,
'role_id' => (int) 5,
'instructions' => 'Design logo for website.com website, (instructions)',
'date_start' => object(CakeI18nFrozenDate) {

'time' => '2018-12-20T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'date_end' => object(CakeI18nFrozenDate) {

'time' => '2018-12-22T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'total_minutes' => (int) 120,
'assigned_to' => (int) 1,
'assigned_from' => (int) 1,
'customer_id' => (int) 1,
'progress' => null,
'progress_weight_id' => (int) 2,
'priority' => (int) 1,
'status_id' => (int) 2,
'shared_folder_path' => 'path_to_logo_files',
'created_by' => null,
'created_date' => null,
'price' => (float) 0,
'cost' => (float) 0,
'project_status' => object(AppModelEntityProjectStatus) {

'id' => (int) 2,
'status' => 'Running',
'[new]' => false,
'[accessible]' => [
'status' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'ProjectStatus'

},
'[new]' => false,
'[accessible]' => [
'name' => true,
'task_type_id' => true,
'role_id' => true,
'instructions' => true,
'date_start' => true,
'date_end' => true,
'total_minutes' => true,
'assigned_to' => true,
'assigned_from' => true,
'customer_id' => true,
'progress' => true,
'progress_weight_id' => true,
'priority' => true,
'status_id' => true,
'shared_folder_path' => true,
'created_by' => true,
'created_date' => true,
'price' => true,
'cost' => true,
'task_type' => true,
'role' => true,
'users_to' => true,
'users_from' => true,
'users_by' => true,
'user' => true,
'customer' => true,
'progress_weight_label' => true,
'project_status' => true,
'transactions' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'TasksTo'

}
]









share|improve this question

























  • is this typo ? 'foreignKey' => 'assigned_From', _F... ?

    – Salines
    Jan 7 at 15:54














0












0








0








I am new developer in CakePHP and PHP.




I have 2 tables: Tasks, Users and Customers.




Among others Tasks has this foreign key linked to Users table: Assigned_from and the foreign key Customer_id linked to Customers table.



So in UsersTable.php I have inserted these lines:





Function initialize :



$this->hasMany('TasksFrom', [
'foreignKey' => 'assigned_From',
'className' => 'Tasks'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'TasksFrom'));




Accordingly in TasksTable.php :
Function initialize :



$this->belongsTo('UsersFrom', [
'foreignKey' => 'assigned_from',
'className' => 'Users'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'UsersFrom'));




And in CustomersTable.php:



Function Initialize:



$this->hasMany('Tasks', [
'foreignKey' => 'customer_id'
]);


So in order to show this information in the User view I have added these lines in UsersController.php :



public function view($id = null)
{
$user = $this->Users->get($id,[
'contain' => ['TasksTo', 'TasksFrom', 'TasksBy']
]);
$this->set('user', $user);
}


How I can modify my code in order to display User Name instead of User Id when accessing echo $task->assigned_from and Customer name instead of Customer_id when accessing echo $task->customer_id?



Here is the current code in users/view.ctp:



foreach ($user->tasks_to as $task) {


?>
<tr id="<?php echo $task['id'] ?>">
<td><?php echo $task->priority ?></td>
<td><?php echo $task->name ?></td>
<td><?php echo $task->instructions ?></td>
<td><?php echo $task->assigned_from ?></td> //It displays user id, I want to display user name
<td><?php echo $task->customer_id ?></td> //Display Customer name instead of Customer_id
<td><?php echo $task->progress ?></td>
</tr>
<?php } ?>


Debug output debug($user->tasks_to):



(int) 1 => object(AppModelEntityTask) {

'id' => (int) 2,
'name' => 'Design Logo for Website',
'task_type_id' => (int) 1,
'role_id' => (int) 5,
'instructions' => 'Design logo for website.com website, (instructions)',
'date_start' => object(CakeI18nFrozenDate) {

'time' => '2018-12-20T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'date_end' => object(CakeI18nFrozenDate) {

'time' => '2018-12-22T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'total_minutes' => (int) 120,
'assigned_to' => (int) 1,
'assigned_from' => (int) 1,
'customer_id' => (int) 1,
'progress' => null,
'progress_weight_id' => (int) 2,
'priority' => (int) 1,
'status_id' => (int) 2,
'shared_folder_path' => 'path_to_logo_files',
'created_by' => null,
'created_date' => null,
'price' => (float) 0,
'cost' => (float) 0,
'project_status' => object(AppModelEntityProjectStatus) {

'id' => (int) 2,
'status' => 'Running',
'[new]' => false,
'[accessible]' => [
'status' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'ProjectStatus'

},
'[new]' => false,
'[accessible]' => [
'name' => true,
'task_type_id' => true,
'role_id' => true,
'instructions' => true,
'date_start' => true,
'date_end' => true,
'total_minutes' => true,
'assigned_to' => true,
'assigned_from' => true,
'customer_id' => true,
'progress' => true,
'progress_weight_id' => true,
'priority' => true,
'status_id' => true,
'shared_folder_path' => true,
'created_by' => true,
'created_date' => true,
'price' => true,
'cost' => true,
'task_type' => true,
'role' => true,
'users_to' => true,
'users_from' => true,
'users_by' => true,
'user' => true,
'customer' => true,
'progress_weight_label' => true,
'project_status' => true,
'transactions' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'TasksTo'

}
]









share|improve this question
















I am new developer in CakePHP and PHP.




I have 2 tables: Tasks, Users and Customers.




Among others Tasks has this foreign key linked to Users table: Assigned_from and the foreign key Customer_id linked to Customers table.



So in UsersTable.php I have inserted these lines:





Function initialize :



$this->hasMany('TasksFrom', [
'foreignKey' => 'assigned_From',
'className' => 'Tasks'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'TasksFrom'));




Accordingly in TasksTable.php :
Function initialize :



$this->belongsTo('UsersFrom', [
'foreignKey' => 'assigned_from',
'className' => 'Users'
]);


Function buildrules :



$rules->add($rules->existsIn(['assigned_from'], 'UsersFrom'));




And in CustomersTable.php:



Function Initialize:



$this->hasMany('Tasks', [
'foreignKey' => 'customer_id'
]);


So in order to show this information in the User view I have added these lines in UsersController.php :



public function view($id = null)
{
$user = $this->Users->get($id,[
'contain' => ['TasksTo', 'TasksFrom', 'TasksBy']
]);
$this->set('user', $user);
}


How I can modify my code in order to display User Name instead of User Id when accessing echo $task->assigned_from and Customer name instead of Customer_id when accessing echo $task->customer_id?



Here is the current code in users/view.ctp:



foreach ($user->tasks_to as $task) {


?>
<tr id="<?php echo $task['id'] ?>">
<td><?php echo $task->priority ?></td>
<td><?php echo $task->name ?></td>
<td><?php echo $task->instructions ?></td>
<td><?php echo $task->assigned_from ?></td> //It displays user id, I want to display user name
<td><?php echo $task->customer_id ?></td> //Display Customer name instead of Customer_id
<td><?php echo $task->progress ?></td>
</tr>
<?php } ?>


Debug output debug($user->tasks_to):



(int) 1 => object(AppModelEntityTask) {

'id' => (int) 2,
'name' => 'Design Logo for Website',
'task_type_id' => (int) 1,
'role_id' => (int) 5,
'instructions' => 'Design logo for website.com website, (instructions)',
'date_start' => object(CakeI18nFrozenDate) {

'time' => '2018-12-20T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'date_end' => object(CakeI18nFrozenDate) {

'time' => '2018-12-22T00:00:00+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false

},
'total_minutes' => (int) 120,
'assigned_to' => (int) 1,
'assigned_from' => (int) 1,
'customer_id' => (int) 1,
'progress' => null,
'progress_weight_id' => (int) 2,
'priority' => (int) 1,
'status_id' => (int) 2,
'shared_folder_path' => 'path_to_logo_files',
'created_by' => null,
'created_date' => null,
'price' => (float) 0,
'cost' => (float) 0,
'project_status' => object(AppModelEntityProjectStatus) {

'id' => (int) 2,
'status' => 'Running',
'[new]' => false,
'[accessible]' => [
'status' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'ProjectStatus'

},
'[new]' => false,
'[accessible]' => [
'name' => true,
'task_type_id' => true,
'role_id' => true,
'instructions' => true,
'date_start' => true,
'date_end' => true,
'total_minutes' => true,
'assigned_to' => true,
'assigned_from' => true,
'customer_id' => true,
'progress' => true,
'progress_weight_id' => true,
'priority' => true,
'status_id' => true,
'shared_folder_path' => true,
'created_by' => true,
'created_date' => true,
'price' => true,
'cost' => true,
'task_type' => true,
'role' => true,
'users_to' => true,
'users_from' => true,
'users_by' => true,
'user' => true,
'customer' => true,
'progress_weight_label' => true,
'project_status' => true,
'transactions' => true
],
'[dirty]' => ,
'[original]' => ,
'[virtual]' => ,
'[errors]' => ,
'[invalid]' => ,
'[repository]' => 'TasksTo'

}
]






php cakephp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 7 at 14:24







aggtr

















asked Jan 4 at 11:47









aggtraggtr

528




528













  • is this typo ? 'foreignKey' => 'assigned_From', _F... ?

    – Salines
    Jan 7 at 15:54



















  • is this typo ? 'foreignKey' => 'assigned_From', _F... ?

    – Salines
    Jan 7 at 15:54

















is this typo ? 'foreignKey' => 'assigned_From', _F... ?

– Salines
Jan 7 at 15:54





is this typo ? 'foreignKey' => 'assigned_From', _F... ?

– Salines
Jan 7 at 15:54












1 Answer
1






active

oldest

votes


















1














<td><?php echo $task->assigned_from ?></td>   
//It displays user id, I want to display user name


Something like:



<?= $task->users_from->name ?>


and



<td><?php echo $task->customer_id ?></td>
//Display Customer name instead of Customer_id


like:



<?= $task->customers->name ?>





share|improve this answer


























  • It's not working, I get the error 'Trying to get property 'name' of non-object'

    – aggtr
    Jan 7 at 9:03











  • what display debug($task) ?

    – Salines
    Jan 7 at 13:56











  • I updated op with the debug output

    – aggtr
    Jan 7 at 14:25











  • you need to create deeper association like this one 'project_status'

    – Salines
    Jan 7 at 15:51











  • How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

    – aggtr
    Jan 7 at 16:56












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54038394%2fcakephp-display-name-instead-of-id-in-linked-tables%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














<td><?php echo $task->assigned_from ?></td>   
//It displays user id, I want to display user name


Something like:



<?= $task->users_from->name ?>


and



<td><?php echo $task->customer_id ?></td>
//Display Customer name instead of Customer_id


like:



<?= $task->customers->name ?>





share|improve this answer


























  • It's not working, I get the error 'Trying to get property 'name' of non-object'

    – aggtr
    Jan 7 at 9:03











  • what display debug($task) ?

    – Salines
    Jan 7 at 13:56











  • I updated op with the debug output

    – aggtr
    Jan 7 at 14:25











  • you need to create deeper association like this one 'project_status'

    – Salines
    Jan 7 at 15:51











  • How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

    – aggtr
    Jan 7 at 16:56
















1














<td><?php echo $task->assigned_from ?></td>   
//It displays user id, I want to display user name


Something like:



<?= $task->users_from->name ?>


and



<td><?php echo $task->customer_id ?></td>
//Display Customer name instead of Customer_id


like:



<?= $task->customers->name ?>





share|improve this answer


























  • It's not working, I get the error 'Trying to get property 'name' of non-object'

    – aggtr
    Jan 7 at 9:03











  • what display debug($task) ?

    – Salines
    Jan 7 at 13:56











  • I updated op with the debug output

    – aggtr
    Jan 7 at 14:25











  • you need to create deeper association like this one 'project_status'

    – Salines
    Jan 7 at 15:51











  • How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

    – aggtr
    Jan 7 at 16:56














1












1








1







<td><?php echo $task->assigned_from ?></td>   
//It displays user id, I want to display user name


Something like:



<?= $task->users_from->name ?>


and



<td><?php echo $task->customer_id ?></td>
//Display Customer name instead of Customer_id


like:



<?= $task->customers->name ?>





share|improve this answer















<td><?php echo $task->assigned_from ?></td>   
//It displays user id, I want to display user name


Something like:



<?= $task->users_from->name ?>


and



<td><?php echo $task->customer_id ?></td>
//Display Customer name instead of Customer_id


like:



<?= $task->customers->name ?>






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 7 at 13:55

























answered Jan 4 at 17:40









SalinesSalines

3,17331235




3,17331235













  • It's not working, I get the error 'Trying to get property 'name' of non-object'

    – aggtr
    Jan 7 at 9:03











  • what display debug($task) ?

    – Salines
    Jan 7 at 13:56











  • I updated op with the debug output

    – aggtr
    Jan 7 at 14:25











  • you need to create deeper association like this one 'project_status'

    – Salines
    Jan 7 at 15:51











  • How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

    – aggtr
    Jan 7 at 16:56



















  • It's not working, I get the error 'Trying to get property 'name' of non-object'

    – aggtr
    Jan 7 at 9:03











  • what display debug($task) ?

    – Salines
    Jan 7 at 13:56











  • I updated op with the debug output

    – aggtr
    Jan 7 at 14:25











  • you need to create deeper association like this one 'project_status'

    – Salines
    Jan 7 at 15:51











  • How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

    – aggtr
    Jan 7 at 16:56

















It's not working, I get the error 'Trying to get property 'name' of non-object'

– aggtr
Jan 7 at 9:03





It's not working, I get the error 'Trying to get property 'name' of non-object'

– aggtr
Jan 7 at 9:03













what display debug($task) ?

– Salines
Jan 7 at 13:56





what display debug($task) ?

– Salines
Jan 7 at 13:56













I updated op with the debug output

– aggtr
Jan 7 at 14:25





I updated op with the debug output

– aggtr
Jan 7 at 14:25













you need to create deeper association like this one 'project_status'

– Salines
Jan 7 at 15:51





you need to create deeper association like this one 'project_status'

– Salines
Jan 7 at 15:51













How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

– aggtr
Jan 7 at 16:56





How I can achieve that? In taskstable.php I have both $this->belongsTo('Customers', [ 'foreignKey' => 'customer_id' ]); and $this->belongsTo('ProjectStatus', [ 'foreignKey' => 'status_id' ]); I cant see any other difference between them

– aggtr
Jan 7 at 16:56




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54038394%2fcakephp-display-name-instead-of-id-in-linked-tables%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'