select with join, no field in output
Collapse
X
-
The difference is that DocumentFolder1 starts from an upper case letter. It's supposed to be a lower case. -
Please, here the docs example. What is the difference between ['meetingUser.status', 'meetingStatus'] from sample and 'DocumentFolder1.name', 'name1'] from my code ?
<?php
$query = $entityManager
->getRDBRepository('Meeting')
->select([
'id',
'name',
['meetingUser.status', 'meetingStatus'], // expression and alias
])
->join(
'MeetingUser', // meeting_user table
'meetingUser', // alias
[
'meetingUser.meetingId:' => 'id', // join condition
'meetingUser.deleted' => false, // important
],
)
->where([
'meetingUser.userId' => $user->getId(),
])
->find();Leave a comment:
-
Because DocumentFolder entity does not have such a field. Don't use the repository, build a select query and then a PDOStatement. https://docs.espocrm.com/development/orm/#query-builderLeave a comment:
-
select with join, no field in output
I want to select DocumentFolder with it's parent , but no field in output (screenshot in attach)
$collection = $entityManager
->getRDBRepository('DocumentFolder')
->select([
'id',
'name',
'parentId',
'DocumentFolder1.id',
['DocumentFolder1.name', 'name1']
])
->join(
'DocumentFolder', // meeting_user table
'DocumentFolder1', // alias
[
'DocumentFolder1.id:' => 'parentId', // join condition
'deleted' => false, // important
],
)->find();
$newlistdata = $collection->getValueMapList();
How to add field in output ?Last edited by Zuzz; 07-28-2024, 08:07 AM.Tags: None
Leave a comment: