/** * @test * @expectedException \F3\FLOW3\Object\Exception\InvalidObjectConfigurationException * @author Robert Lemke <*****@*****.**> */ public function invalidOptionResultsInException() { $configurationArray = array('scoopy' => 'prototype'); $builtObjectConfiguration = \F3\FLOW3\Object\Configuration\ConfigurationBuilder::buildFromConfigurationArray('TestObject', $configurationArray, __CLASS__); }
/** * Traverses through all active packages and registers their classes as * objects at the object manager. Finally the object configuration * defined by the package is loaded and applied to the registered objects. * * @param array $packages The packages whose classes should be registered * @return void * @author Robert Lemke <*****@*****.**> */ protected function registerAndConfigureAllPackageObjects(array $packages) { $objectTypes = array(); $availableClassNames = array(); foreach ($packages as $packageKey => $package) { foreach (array_keys($package->getClassFiles()) as $className) { if (!$this->classNameIsBlacklisted($className)) { $availableClassNames[] = $className; } } } foreach ($availableClassNames as $className) { if (substr($className, -9, 9) === 'Interface') { $objectTypes[] = $className; if (!isset($this->registeredObjects[$className])) { $this->registerObjectType($className); } } else { if (!isset($this->registeredObjects[$className])) { if (!$this->reflectionService->isClassAbstract($className)) { $this->registerObject($className, $className); } } } } foreach (array_keys($packages) as $packageKey) { $rawObjectConfigurations = $this->configurationManager->getConfiguration(\F3\FLOW3\Configuration\ConfigurationManager::CONFIGURATION_TYPE_OBJECTS, $packageKey); foreach ($rawObjectConfigurations as $objectName => $rawObjectConfiguration) { $objectName = str_replace('_', '\\', $objectName); if (!isset($this->registeredObjects[$objectName])) { throw new \F3\FLOW3\Object\Exception\InvalidObjectConfigurationException('Tried to configure unknown object "' . $objectName . '" in package "' . $packageKey . '".', 1184926175); } if (is_array($rawObjectConfiguration)) { $existingObjectConfiguration = isset($this->objectConfigurations[$objectName]) ? $this->objectConfigurations[$objectName] : NULL; $this->objectConfigurations[$objectName] = \F3\FLOW3\Object\Configuration\ConfigurationBuilder::buildFromConfigurationArray($objectName, $rawObjectConfiguration, 'Package ' . $packageKey, $existingObjectConfiguration); } } } }