public function registerRelationshipDefinitions($relation)
    {
        //convert to something that makes sense :)
        switch ($relation->getType()) {
            case PhalconRelation::HAS_ONE:
            case PhalconRelation::BELONGS_TO:
            case PhalconRelation::HAS_ONE_THROUGH:
                $name = $relation->getTableName('singular');
                break;
            case PhalconRelation::HAS_MANY:
            case PhalconRelation::HAS_MANY_THROUGH:
                $name = $relation->getTableName('plural');
                break;
            default:
                throw new HTTPException('A Bad Relationship Type was supplied!', 500, ['code' => '8948616164789797']);
        }
        $this->relationshipRegistry[strtolower($name)] = $relation;
    }
public function registerRelationshipDefinitions($relation)
    {
        //convert to something that makes sense :)
        switch ($relation->getType()) {
            case PhalconRelation::HAS_ONE:
            case PhalconRelation::BELONGS_TO:
            case PhalconRelation::HAS_ONE_THROUGH:
                $name = $relation->getTableName('singular');
                break;
            case PhalconRelation::HAS_MANY:
            case PhalconRelation::HAS_MANY_THROUGH:
                $name = $relation->getTableName('plural');
                break;
            default:
                throw new HTTPException('A Bad Relationship Type was supplied!', 500, ['code' => '8948616164789797']);
        }
        $this->relationshipRegistry[strtolower($name)] = $relation;
    }
public function registerRelationshipDefinitions ( $ relation ) { //convert to something that makes sense :) switch ( $ relation -> getType ( ) ) { case PhalconRelation :: HAS_ONE : case PhalconRelation :: BELONGS_TO : case PhalconRelation :: HAS_ONE_THROUGH : $ name = $ relation -> getTableName ( 'singular' ) ; break ; case PhalconRelation :: HAS_MANY : case PhalconRelation :: HAS_MANY_THROUGH : $ name = $ relation -> getTableName ( 'plural' ) ; break ; default : throw new HTTPException ( 'A Bad Relationship Type was supplied!' , 500 , [ 'code' => '8948616164789797' ] ) ; } $ this -> relationshipRegistry [ strtolower ( $ name ) ] = $ relation ; }
write or overwrite a definition
each definition should map to a table name
we'll massage the name a little bit to cut down on errors

// 1 = hasOne 0 = belongsTo 2 = hasMany

@throws HTTPException
@param \PhalconRest\Api\Relation|PhalconRelation $relation
write or overwrite a definition each definition should map to a table name we ll massage the name a little bit to cut down on errors