/** * @return Psc\CMS\Component */ public function inferComponent(Type $type) { if (array_key_exists($type->getName(), $this->explicitMappings)) { $component = $this->createComponent($this->explicitMappings[$type->getName()]); } elseif ($type instanceof MappedComponentType) { $component = $type->getMappedComponent($this); } else { throw NoComponentFoundException::build("Zum Type '%s' konnte keine Komponente ermittelt werden. Das einfachste ist im Type \\Webforge\\Types\\MappedComponentType zu implementieren.", $type->getName())->set('type', $type)->end(); } $component->setType($type); $this->manager->dispatchEvent(self::EVENT_COMPONENT_MAPPED, compact('component', 'type'), $this); return $component; }