/** * @author Sebastian Michaelsen <*****@*****.**> * @param \EBT\ExtensionBuilder\Domain\Model\Extension $extension * @return void * @throws ExtensionException */ private function validateDomainObjects($extension) { $actionCounter = 0; foreach ($extension->getDomainObjects() as $domainObject) { $actionCounter .= count($domainObject->getActions()); // Check if domainObject name is given if (!$domainObject->getName()) { $this->validationResult['errors'][] = new ExtensionException('A Domain Object has no name', self::ERROR_DOMAINOBJECT_NO_NAME); } /** * Character test * Allowed characters are: a-z (lowercase), A-Z (uppercase) and 0-9 */ if (!preg_match('/^[a-zA-Z0-9]*$/', $domainObject->getName())) { $this->validationResult['errors'][] = new ExtensionException('Illegal domain object name "' . $domainObject->getName() . '". Please use UpperCamelCase, no spaces or underscores.', self::ERROR_DOMAINOBJECT_ILLEGAL_CHARACTER); } $objectName = $domainObject->getName(); $firstChar = $objectName[0]; if (strtolower($firstChar) == $firstChar) { $this->validationResult['errors'][] = new ExtensionException('Illegal first character of domain object name "' . $domainObject->getName() . '". Please use UpperCamelCase.', self::ERROR_DOMAINOBJECT_LOWER_FIRST_CHARACTER); } if (\EBT\ExtensionBuilder\Service\ValidationService::isReservedExtbaseWord($objectName)) { $this->validationResult['errors'][] = new ExtensionException('Domain object name "' . $domainObject->getName() . '" may not be used in extbase.', self::ERROR_PROPERTY_RESERVED_WORD); } $this->validateProperties($domainObject); $this->validateDomainObjectActions($domainObject); $this->validateMapping($domainObject); } if ($actionCounter < 1) { if (count($extension->getBackendModules()) > 0) { $this->validationResult['warnings'][] = new ExtensionException('Potential misconfiguration: No actions configured!' . LF . 'This will result in a missing default action in your backend module', self::ERROR_ACTION_MISCONFIGURATION); } if (count($extension->getPlugins()) > 0) { $this->validationResult['warnings'][] = new ExtensionException('Potential misconfiguration: No actions configured!' . LF . 'This will result in a missing default action in your plugin', self::ERROR_ACTION_MISCONFIGURATION); } } }