select with join, no field in output

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • yuri
    replied
    The difference is that DocumentFolder1 starts from an upper case letter. It's supposed to be a lower case.

    Leave a comment:


  • Zuzz
    replied
    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:


  • yuri
    replied
    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-builder

    Leave a comment:


  • Zuzz
    started a topic select with join, no field in output

    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 ?
    Attached Files
    Last edited by Zuzz; 07-28-2024, 08:07 AM.
Working...