ORM search empty is null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    ORM search empty is null

    Hi,
    what is the code for search "empty" aor "IS NULL" with ORM ?
    PHP Code:
    $accountList = $entityManager->getRepository('Account')->where([
        'type' => ''
    ])->find(); 
    

    Thanks in advance
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • dimyy
    Active Community Member
    • Jun 2018
    • 569

    #2
    'OR' => [
    ['assignedUserId' => null],
    ['assignedUserId' => '']
    ]

    Field without default value is null when entity created.
    Value is '' when you clear field

    Comment

    • yuri
      Member
      • Mar 2014
      • 8453

      #3
      > Value is '' when you clear field

      What type of field? I tried to fix such behavior where I could find.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment


      • dimyy
        dimyy commented
        Editing a comment
        May be it's my mistake and value = '' appears after this code:
        $queue->set('assignedUserId', $entity->get('assignedUserId'));
        when $entity.assignedUserId is empty
    Working...