Merge two whereClause 'OR'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dimyy
    Active Community Member
    • Jun 2018
    • 569

    Merge two whereClause 'OR'

    I try to customize accessPortalOnlyAccount.

    whereClause can't have two 'OR' elements - all elements should be in one 'OR' element.

    Return from parent::accessPortalOnlyAccount looks like
    Code:
      "whereClause": [
        {
          "OR": {
            }
       }
      ]
    and only how can I add some conditions to 'OR' is $result['whereClause'][0]['OR'][]=[something].

    I assume that the code


    PHP Code:
    $result['whereClause'][] = [
                    'OR' => $or
                ]; 
    
    should be

    PHP Code:
    $result['whereClause']['OR'] =$or; 
    
    for clear access in customized function
    PHP Code:
    $result['whereClause']['OR'] 
    
    without [0].

    Am I right?



  • yuri
    Member
    • Mar 2014
    • 8493

    #2
    It's made intentionally inside an array to prevent incidental changing (by a programmer) in another place. And also to avoid conflict if 'OR' is already defined by a programmer before ACL applied.

    You just need to build own statement from scratch (in your custom SelectManager class).
    Last edited by yuri; 05-08-2020, 02:01 PM.
    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...