FOF30\Model\DataModel\RelationManager::getRelationTypes PHP Method

getRelationTypes() public static method

Populates the static map of relation type methods and relation handling classes
public static getRelationTypes ( ) : array
return array Key = method name, Value = relation handling class
    public static function getRelationTypes()
    {
        if (empty(static::$relationTypes)) {
            $relationTypeDirectory = __DIR__ . '/Relation';
            $fs = new \DirectoryIterator($relationTypeDirectory);
            /** @var $file \DirectoryIterator */
            foreach ($fs as $file) {
                if ($file->isDir()) {
                    continue;
                }
                if ($file->getExtension() != 'php') {
                    continue;
                }
                $baseName = ucfirst($file->getBasename('.php'));
                $methodName = strtolower($baseName[0]) . substr($baseName, 1);
                $className = '\\FOF30\\Model\\DataModel\\Relation\\' . $baseName;
                if (!class_exists($className, true)) {
                    continue;
                }
                static::$relationTypes[$methodName] = $className;
            }
        }
        return static::$relationTypes;
    }