Propel 2 API
Class

Propel\Runtime\Map\RelationMap

class RelationMap

RelationMap is used to model a database relationship.

GENERAL NOTE
------------
The propel.map classes are abstract building-block classes for modeling
the database at runtime. These classes are similar (a lite version) to the
propel.engine.database.model classes, which are build-time modeling classes.
These classes in themselves do not do any database metadata lookups.

Constants

MANY_TO_ONE

ONE_TO_MANY

ONE_TO_ONE

MANY_TO_MANY

LOCAL_TO_FOREIGN

LEFT_TO_RIGHT

Methods

__construct(string $name)

Constructor.

string getName()

Get the name of this relation.

setPluralName($pluralName)

string getPluralName()

Get the plural name of this relation.

setType(int $type)

Set the type

int getType()

Get the type

setLocalTable(TableMap $table)

Set the local table

TableMap getLocalTable()

Get the local table

setForeignTable(TableMap $table)

Set the foreign table

TableMap getForeignTable()

Get the foreign table

TableMap getLeftTable()

Get the left table of the relation

TableMap getRightTable()

Get the right table of the relation

addColumnMapping(ColumnMap $local, ColumnMap $foreign)

Add a column mapping

array getColumnMappings(int $direction = RelationMap::LOCAL_TO_FOREIGN)

Get an associative array mapping local column names to foreign column names The arrangement of the returned array depends on the $direction parameter: - If the value is RelationMap::LOCAL_TO_FOREIGN, then the returned array is local => foreign - If the value is RelationMap::LEFT_TO_RIGHT, then the returned array is left => right

boolean isComposite()

Returns true if the relation has more than one column mapping

int countColumnMappings()

Return the number of column mappings

ColumnMap[] getLocalColumns()

Get the local columns

ColumnMap[] getForeignColumns()

Get the foreign columns

ColumnMap[] getLeftColumns()

Get the left columns of the relation

ColumnMap[] getRightColumns()

Get the right columns of the relation

setOnUpdate(string $onUpdate)

Set the onUpdate behavior

integer getOnUpdate()

Get the onUpdate behavior

setOnDelete(string $onDelete)

Set the onDelete behavior

int getOnDelete()

Get the onDelete behavior

RelationMap getSymmetricalRelation()

Gets the symmetrical relation

Details

at line 70
public __construct(string $name)

Constructor.

Parameters

string $name Name of the relation.

at line 80
public string getName()

Get the name of this relation.

Return Value

string The name of the relation.

at line 85
public setPluralName($pluralName)

Parameters

$pluralName

at line 95
public string getPluralName()

Get the plural name of this relation.

Return Value

string The plural name of the relation.

at line 105
public setType(int $type)

Set the type

Parameters

int $type The relation type (either self::MANY_TO_ONE, self::ONE_TO_MANY, or self::ONE_TO_ONE)

at line 115
public int getType()

Get the type

Return Value

int the relation type

at line 125
public setLocalTable(TableMap $table)

Set the local table

Parameters

TableMap $table The local table for this relationship

at line 135
public TableMap getLocalTable()

Get the local table

Return Value

TableMap The local table for this relationship

at line 145
public setForeignTable(TableMap $table)

Set the foreign table

Parameters

TableMap $table The foreign table for this relationship

at line 155
public TableMap getForeignTable()

Get the foreign table

Return Value

TableMap The foreign table for this relationship

at line 165
public TableMap getLeftTable()

Get the left table of the relation

Return Value

TableMap The left table for this relationship

at line 175
public TableMap getRightTable()

Get the right table of the relation

Return Value

TableMap The right table for this relationship

at line 186
public addColumnMapping(ColumnMap $local, ColumnMap $foreign)

Add a column mapping

Parameters

ColumnMap $local The local column
ColumnMap $foreign The foreign column

at line 201
public array getColumnMappings(int $direction = RelationMap::LOCAL_TO_FOREIGN)

Get an associative array mapping local column names to foreign column names The arrangement of the returned array depends on the $direction parameter: - If the value is RelationMap::LOCAL_TO_FOREIGN, then the returned array is local => foreign - If the value is RelationMap::LEFT_TO_RIGHT, then the returned array is left => right

Parameters

int $direction How the associative array must return columns

Return Value

array Associative array (local => foreign) of fully qualified column names

at line 225
public boolean isComposite()

Returns true if the relation has more than one column mapping

Return Value

boolean

at line 235
public int countColumnMappings()

Return the number of column mappings

Return Value

int

at line 245
public ColumnMap[] getLocalColumns()

Get the local columns

Return Value

ColumnMap[]

at line 255
public ColumnMap[] getForeignColumns()

Get the foreign columns

Return Value

ColumnMap[]

at line 265
public ColumnMap[] getLeftColumns()

Get the left columns of the relation

Return Value

ColumnMap[]

at line 275
public ColumnMap[] getRightColumns()

Get the right columns of the relation

Return Value

ColumnMap[]

at line 285
public setOnUpdate(string $onUpdate)

Set the onUpdate behavior

Parameters

string $onUpdate

at line 295
public integer getOnUpdate()

Get the onUpdate behavior

Return Value

integer the relation type

at line 305
public setOnDelete(string $onDelete)

Set the onDelete behavior

Parameters

string $onDelete

at line 315
public int getOnDelete()

Get the onDelete behavior

Return Value

int the relation type

at line 325
public RelationMap getSymmetricalRelation()

Gets the symmetrical relation

Return Value

RelationMap