Doctrine\Common\Collections\ArrayCollection::isEmpty PHP Method

isEmpty() public method

{@inheritDoc}
public isEmpty ( )
    public function isEmpty()
    {
        return empty($this->elements);
    }

Usage Example

 /**
  * @param array $collection
  * @param MapInterface $map
  * @param ObjectFactoryInterface|string $factory
  * @param null $aggregator
  * @throws \InvalidArgumentException
  */
 public function processing(array $collection, MapInterface $map, $factory, $aggregator = null)
 {
     $this->aggregator = $aggregator;
     $this->collection = new ArrayCollection($collection);
     $this->map = $map;
     // Checking type of factory and then set as internal tool
     if (is_string($factory)) {
         $this->factory = $this->container->get($factory);
     } else {
         $this->factory = $factory;
     }
     if (count($collection) == 0) {
         throw new \InvalidArgumentException('Collection can\'t be null');
     }
     // Split collection to "new" and "exists"
     $this->ranking();
     // If collection "exists" not empty, then load items form database
     if (!$this->exists->isEmpty()) {
         $this->loadExistsObjects();
     }
     // If collection "new" not empty, then create new entities
     if (!$this->new->isEmpty()) {
         $this->createNewObjects();
     }
     // Clean internal "common" collection
     $this->collection->clear();
     // Clean aggregator
     $this->aggregator = null;
 }
All Usage Examples Of Doctrine\Common\Collections\ArrayCollection::isEmpty