Пример #1
0
 /**
  * @param FilteringElement[] $elements
  * @param $selector
  * @return array
  */
 public function filterNot(array $elements, $selector)
 {
     $query = new Query($selector);
     if ($query->isValid() == false || count($elements) == 0) {
         return [];
     }
     $selected = [];
     foreach ($elements as $element) {
         if ($element instanceof FilteringElement == false) {
             continue;
         }
         foreach ($query->getSelectors() as $s) {
             foreach ($s->getConditions() as $c) {
                 $attributeValue = $element->getAttributeValue($c->getName());
                 $compare = $c->compareValue($attributeValue);
                 if ($attributeValue == false || $compare == false) {
                     $selected[] = $element;
                     continue 3;
                 }
             }
         }
     }
     return $selected;
 }
Пример #2
0
 public function find(Query &$query)
 {
     return $query->select($this->children);
 }