/** * Resolves a registered namespace alias to the full namespace. * * @param string $alias * @return string * @throws OHMException */ public function getAliasNamespace($alias) { foreach (array_keys($this->getManagers()) as $name) { try { return $this->getManager($name)->getConfiguration()->getEntityNamespace($alias); } catch (OHMException $e) { } } throw OHMException::unknownEntityNamespace($alias); }
/** * Adds a custom type to the type map. * * @static * @param string $name Name of the type. This should correspond to what getName() returns. * @param string $className The class name of the custom type. * @throws OHMException */ public static function addType($name, $className) { if (isset(self::$typesMap[$name])) { throw OHMException::typeExists($name); } self::$typesMap[$name] = $className; }
/** * Sets default repository class. * * @param string $className * @return void * @throws OHMException If not a ObjectRepository */ public function setDefaultRepositoryClassName($className) { $reflectionClass = new ReflectionClass($className); if (!$reflectionClass->implementsInterface('Doctrine\\Common\\Persistence\\ObjectRepository')) { throw OHMException::invalidEntityRepository($className); } $this->attributes['defaultRepositoryClassName'] = $className; }