Class Phalcon\Mvc\Model\Relation

implements Phalcon\Mvc\Model\RelationInterface

This class represents a relationship between two models

Constants

integer BELONGS_TO

integer HAS_ONE

integer HAS_MANY

integer HAS_ONE_THROUGH

integer HAS_MANY_THROUGH

integer NO_ACTION

integer ACTION_RESTRICT

integer ACTION_CASCADE

Methods

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

Phalcon\Mvc\Model\Relation constructor

public setIntermediateRelation (string|array $intermediateFields, string $intermediateModel, string $intermediateReferencedFields)

Sets the intermediate model data for has-*-through relations

public int getType ()

Returns the relation 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 isForeignKey ()

Check whether the relation act as a foreign key

public string|array getForeignKey ()

Returns the foreign key configuration

public boolean isThrough ()

Check whether the relation is a ‘many-to-many’ relation or not

public boolean isReusable ()

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

public string|array getIntermediateFields ()

Gets the intermediate fields for has-*-through relations

public string getIntermediateModel ()

Gets the intermediate model for has-*-through relations

public string|array getIntermediateReferencedFields ()

Gets the intermediate referenced fields for has-*-through relations

© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Mvc_Model_Relation.html