Class

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(integer $type)

Set the type

integer 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::LOCALTOFOREIGN, then the returned array is local => foreign - If the value is RelationMap::LEFTTORIGHT, 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

Array getLocalColumns()

Get the local columns

Array 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

integer getOnDelete()

Get the onDelete behavior

RelationMap getSymmetricalRelation()

Gets the symmetrical relation

Details

at line 58
public __construct(string $name)

Constructor.

Parameters

string $name Name of the relation.

at line 68
public string getName()

Get the name of this relation.

Return Value

string The name of the relation.

at line 73
public setPluralName($pluralName)

Parameters

$pluralName

at line 83
public string getPluralName()

Get the plural name of this relation.

Return Value

string The plural name of the relation.

at line 93
public setType(integer $type)

Set the type

Parameters

integer $type The relation type (either self::MANYTOONE, self::ONETOMANY, or self::ONETOONE)

at line 103
public integer getType()

Get the type

Return Value

integer the relation type

at line 113
public setLocalTable(TableMap $table)

Set the local table

Parameters

TableMap $table The local table for this relationship

at line 123
public TableMap getLocalTable()

Get the local table

Return Value

TableMap The local table for this relationship

at line 133
public setForeignTable(TableMap $table)

Set the foreign table

Parameters

TableMap $table The foreign table for this relationship

at line 143
public TableMap getForeignTable()

Get the foreign table

Return Value

TableMap The foreign table for this relationship

at line 153
public TableMap getLeftTable()

Get the left table of the relation

Return Value

TableMap The left table for this relationship

at line 163
public TableMap getRightTable()

Get the right table of the relation

Return Value

TableMap The right table for this relationship

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

Add a column mapping

Parameters

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

at line 190
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::LOCALTOFOREIGN, then the returned array is local => foreign - If the value is RelationMap::LEFTTORIGHT, 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 212
public boolean isComposite()

Returns true if the relation has more than one column mapping

Return Value

boolean

at line 222
public int countColumnMappings()

Return the number of column mappings

Return Value

int

at line 232
public Array getLocalColumns()

Get the local columns

Return Value

Array list of ColumnMap objects

at line 242
public Array getForeignColumns()

Get the foreign columns

Return Value

Array list of ColumnMap objects

at line 252
public ColumnMap[] getLeftColumns()

Get the left columns of the relation

Return Value

ColumnMap[]

at line 262
public ColumnMap[] getRightColumns()

Get the right columns of the relation

Return Value

ColumnMap[]

at line 272
public setOnUpdate(string $onUpdate)

Set the onUpdate behavior

Parameters

string $onUpdate

at line 282
public integer getOnUpdate()

Get the onUpdate behavior

Return Value

integer the relation type

at line 292
public setOnDelete(string $onDelete)

Set the onDelete behavior

Parameters

string $onDelete

at line 302
public integer getOnDelete()

Get the onDelete behavior

Return Value

integer the relation type

at line 314
public RelationMap getSymmetricalRelation()

Gets the symmetrical relation

Return Value

RelationMap

Exceptions

PropelException