public function determineFormStoreStrategy(ModelRelationData $data)
    {
        $type       = null;
        $parameters = [];

        // Determine strategy alias
        switch ($data->type) {

            case RelationType::BELONGS_TO:
            case RelationType::BELONGS_TO_THROUGH:
            case RelationType::MORPH_ONE:
            case RelationType::HAS_ONE:
                $type = FormStoreStrategy::RELATION_SINGLE_KEY;
                break;

            case RelationType::BELONGS_TO_MANY:
            case RelationType::HAS_MANY:
            case RelationType::MORPH_MANY:
            case RelationType::MORPH_TO_MANY:
            case RelationType::MORPHED_BY_MANY:
                $type = FormStoreStrategy::RELATION_PLURAL_KEYS;
                break;

            case RelationType::MORPH_TO:
                $type = FormStoreStrategy::RELATION_SINGLE_MORPH;
                break;
        }


        // Determine parameters

        if ($data->translated) {
            $parameters[] = 'translated';
        }

        if (count($parameters)) {
            $type .= ':' . implode(',', $parameters);
        }

        return $type;
    }
public function determineFormStoreStrategy(ModelRelationData $data)
    {
        $type       = null;
        $parameters = [];

        // Determine strategy alias
        switch ($data->type) {

            case RelationType::BELONGS_TO:
            case RelationType::BELONGS_TO_THROUGH:
            case RelationType::MORPH_ONE:
            case RelationType::HAS_ONE:
                $type = FormStoreStrategy::RELATION_SINGLE_KEY;
                break;

            case RelationType::BELONGS_TO_MANY:
            case RelationType::HAS_MANY:
            case RelationType::MORPH_MANY:
            case RelationType::MORPH_TO_MANY:
            case RelationType::MORPHED_BY_MANY:
                $type = FormStoreStrategy::RELATION_PLURAL_KEYS;
                break;

            case RelationType::MORPH_TO:
                $type = FormStoreStrategy::RELATION_SINGLE_MORPH;
                break;
        }


        // Determine parameters

        if ($data->translated) {
            $parameters[] = 'translated';
        }

        if (count($parameters)) {
            $type .= ':' . implode(',', $parameters);
        }

        return $type;
    }
public function determineFormStoreStrategy ( ModelRelationData $ data ) { $ type = null ; $ parameters = [ ] ; // Determine strategy alias switch ( $ data -> type ) { case RelationType :: BELONGS_TO : case RelationType :: BELONGS_TO_THROUGH : case RelationType :: MORPH_ONE : case RelationType :: HAS_ONE : $ type = FormStoreStrategy :: RELATION_SINGLE_KEY ; break ; case RelationType :: BELONGS_TO_MANY : case RelationType :: HAS_MANY : case RelationType :: MORPH_MANY : case RelationType :: MORPH_TO_MANY : case RelationType :: MORPHED_BY_MANY : $ type = FormStoreStrategy :: RELATION_PLURAL_KEYS ; break ; case RelationType :: MORPH_TO : $ type = FormStoreStrategy :: RELATION_SINGLE_MORPH ; break ; } // Determine parameters if ( $ data -> translated ) { $ parameters [ ] = 'translated' ; } if ( count ( $ parameters ) ) { $ type .= ':' . implode ( ',' , $ parameters ) ; } return $ type ; }
Determines a form store strategy string for given relation data.

@param ModelRelationData $data
@return string|null
Determines a form store strategy string for given relation data .