Announcement

Collapse
No announcement yet.

ORM search empty is null

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

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

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

    Comment


    • #3
      > Value is '' when you clear field

      What type of field? I tried to fix such behavior where I could find.

      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...
    X