Example #1
0
 /**
  * {@inheritdoc}
  */
 public function types(array $typeNames)
 {
     foreach ($typeNames as $typeName) {
         $includeDescendants = false;
         if (substr($typeName, -1) === self::ASTERISK) {
             $includeDescendants = true;
             $typeName = rtrim($typeName, self::ASTERISK . IObjectType::PATH_SEPARATOR);
             if (!strlen($typeName)) {
                 $typeName = IObjectType::BASE;
             }
         }
         if (!$this->metadata->getTypeExists($typeName)) {
             throw new NonexistentEntityException($this->translate('Cannot select objects. Object type "{name}" does not exist.', ["name" => $typeName]));
         }
         $this->types[$typeName] = $this->metadata->getType($typeName);
         if ($includeDescendants) {
             $this->types($this->metadata->getDescendantTypesList($typeName));
         }
     }
     return $this;
 }