ORM query syntax to search a multi-enum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bandtank
    Active Community Member
    • Mar 2017
    • 379

    ORM query syntax to search a multi-enum

    I created an entity with a multi-enum. I can't figure out how to search for records that have a specific value selected. Here is the creation of a record:

    PHP Code:
    $t = $this->em->createEntity("Template", array(
        "clientId" => $entity->id,
        "locations" => ["Clinic", "Custom", "Daycare"],
    ));
    That works. However, searching for a record that has the word 'Clinic' in it does not work.

    PHP Code:
    $where = array(
      "clientId" => "some id",
      "locations" => "Clinic",
    );
    $t = $this->em->getRDBRepository("Template")->where($where)->findOne();
    Everything I've tried has failed. I can't figure out how to say "find a record with a location that has this value (and any other values).

    What is the syntax to perform a query that says "look for a record with this value in the list of multi-enum values"?
  • yuri
    Member
    • Mar 2014
    • 8467

    #2
    Here it's covered: https://github.com/espocrm/espocrm/issues/2268
    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

    Working...