We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34178
    • 212 Posts
    In a xPDOQuery::where I do need an Operator '!IN' (Exists not in) like it is described for 'Exists in' here:

    http://rtfm.modx.com/display/xPDO20/xPDOQuery.where

    Can anybody of the modx-team tell me how to realize this?

    At the moment the code is this (not working because !IN seems not to be a valid argument):
    $c = array(
                'published' => '1',
                'cacheable' => '1',
                'class_key' => 'modDocument',
                'alias:!IN' => array('url1','url2'),
        );
    
    $count = $modx->getCount('modResource', $c);
    
    [ed. note: lettis last edited this post 13 years, 9 months ago.]
      • 17403 ☆ A M B ☆
      • 183 Posts
      Use NOTIN or NOT IN instead

      $c = array(
                  'published' => '1',
                  'cacheable' => '1',
                  'class_key' => 'modDocument',
                  'alias:NOTIN' => array('url1','url2'),
      );

        zaenal.lokamaya
        • 34178
        • 212 Posts
        NOTIN doesn´t work, but NOT IN. Thanks a lot!
          • 17403 ☆ A M B ☆
          • 183 Posts
          Found the complete list of xPDO operators in core/xpdo/om/xpdoquery.class.php.

          protected $_operators= array (
                  '=',
                  '!=',
                  '<',
                  '<=',
                  '>',
                  '>=',
                  '<=>',
                  ' LIKE ',
                  ' IS NULL',
                  ' IS NOT NULL',
                  ' BETWEEN ',
                  ' IN ',
                  ' IN(',
                  ' NOT(',
                  ' NOT (',
                  ' NOT IN ',
                  ' NOT IN(',
                  ' EXISTS (',
                  ' EXISTS(',
                  ' NOT EXISTS (',
                  ' NOT EXISTS(',
                  ' COALESCE(',
                  ' GREATEST(',
                  ' INTERVAL(',
                  ' LEAST(',
                  'MATCH(',
                  'MATCH (',
                  'MAX(',
                  'MIN(',
                  'AVG('
              );
            zaenal.lokamaya