src/Label305/AujaLaravel/Auja.php
private function buildComplexIndexMenu($modelName, $modelId, ModelConfig $config = null) {
        $model = $this->aujaConfigurator->getModel($modelName);
        $relations = $this->aujaConfigurator->getRelationsForModel($model);

        $associationRelations = array();
        foreach ($relations as $relation) {
            if ($relation->getType() == Relation::HAS_MANY || $relation->getType() == Relation::HAS_AND_BELONGS_TO) { // TODO: What to do with one-to-one relations?
                $associationRelations[] = $relation;
            }
        }

        switch (count($associationRelations)) {
            case 0:
                $menu = $this->noAssociationsMenuFor($modelName, $config);
                break;
            case 1:
                $menu = $this->singleAssociationMenuFor($modelName, $modelId, $associationRelations[0], $config);
                break;
            default:
                $menu = $this->multipleAssociationsMenuFor($modelName, $modelId, $associationRelations, $config);
                break;
        }

        return $menu;
    }
private function buildComplexIndexMenu($modelName, $modelId, ModelConfig $config = null) {
        $model = $this->aujaConfigurator->getModel($modelName);
        $relations = $this->aujaConfigurator->getRelationsForModel($model);

        $associationRelations = array();
        foreach ($relations as $relation) {
            if ($relation->getType() == Relation::HAS_MANY || $relation->getType() == Relation::HAS_AND_BELONGS_TO) { // TODO: What to do with one-to-one relations?
                $associationRelations[] = $relation;
            }
        }

        switch (count($associationRelations)) {
            case 0:
                $menu = $this->noAssociationsMenuFor($modelName, $config);
                break;
            case 1:
                $menu = $this->singleAssociationMenuFor($modelName, $modelId, $associationRelations[0], $config);
                break;
            default:
                $menu = $this->multipleAssociationsMenuFor($modelName, $modelId, $associationRelations, $config);
                break;
        }

        return $menu;
    }
private function buildComplexIndexMenu ( $ modelName , $ modelId , ModelConfig $ config = null ) { $ model = $ this -> aujaConfigurator -> getModel ( $ modelName ) ; $ relations = $ this -> aujaConfigurator -> getRelationsForModel ( $ model ) ; $ associationRelations = array ( ) ; foreach ( $ relations as $ relation ) { if ( $ relation -> getType ( ) == Relation :: HAS_MANY || $ relation -> getType ( ) == Relation :: HAS_AND_BELONGS_TO ) { // TODO: What to do with one-to-one relations? $ associationRelations [ ] = $ relation ; } } switch ( count ( $ associationRelations ) ) { case 0 : $ menu = $ this -> noAssociationsMenuFor ( $ modelName , $ config ) ; break ; case 1 : $ menu = $ this -> singleAssociationMenuFor ( $ modelName , $ modelId , $ associationRelations [ 0 ] , $ config ) ; break ; default : $ menu = $ this -> multipleAssociationsMenuFor ( $ modelName , $ modelId , $ associationRelations , $ config ) ; break ; } return $ menu ; }
Creates a `Menu` for given model, with a layout depending on its relations.

@param String      $modelName The name of the model to create a `Menu` for.
@param int         $modelId   The id of an instance of the model, 0 for none.
@param ModelConfig $config    (optional) The `ModelConfig` to use.

@return Menu The built `Menu` instance, which can be configured further.
Creates a Menu for given model with a layout depending on its relations .