Exemplo n.º 1
0
 /**
  * Test that you cannot add duplicate filters to the collection via the add() method
  *
  * @expectedException \InvalidArgumentException
  */
 public function testAddInvalidDuplicate()
 {
     $filters = new FilterCollection();
     $filters->add(new FauxFilter(self::NAME_1, self::NAME_1));
     $filters->add(new FauxFilter(self::NAME_1, self::NAME_1));
 }
Exemplo n.º 2
0
 /**
  * If no filter collection is set on loader, assign filters to the loader. If a filter collection is already
  * set, loop through them and add them to the main filter collection
  *
  * @param FilterCollection $filters
  *
  * @return Loader
  */
 public function applyFilters(FilterCollection $filters)
 {
     if ($this->_filters instanceof FilterCollection) {
         foreach ($filters as $filter) {
             $this->_filters->add($filter);
         }
     } else {
         $this->setFilters($filters);
     }
     return $this;
 }