Tabla de Contenidos

Tema anterior

< Class Phalcon\Mvc\Model\Query\Status

Próximo tema

Class Phalcon\Mvc\Model\Resultset >

Esta página

Class Phalcon\Mvc\Model\Relation

implements Phalcon\Mvc\Model\RelationInterface

This class represents each relationship between two models


integer BELONGS_TO

integer HAS_ONE

integer HAS_MANY



integer MANY_TO_MANY


public __construct (int $type, string $referencedModel, string|array $fields, string|array $referencedFields, [array $options])

Phalcon\Mvc\Model\Relation constructor

public int getType ()

Returns the relation’s type

public string getReferencedModel ()

Returns the referenced model

public string|array getFields ()

Returns the fields

public string|array getReferencedFields ()

Returns the referenced fields

public string|array getOptions ()

Returns the options

public string|array isForeingKey ()

Check whether the relation act as a foreign key

public string|array getForeignKey ()

Returns the foreign key configuration

public boolean hasThrough ()

Check whether the relation

public string getThrough ()

Returns the ‘through’ relation if any

public boolean isReusable ()

Check if records in belongs-to/has-many are implicitly cached during the current request