class ForeignKey extends MappingModel
A class for information about table foreign keys.
Constants
NONE |
These constants are the uppercase equivalents of the onDelete / onUpdate values in the schema definition. |
NOACTION |
|
CASCADE |
|
RESTRICT |
|
SETDEFAULT |
|
SETNULL |
|
Methods
__construct(string $name = null)
Constructs a new ForeignKey object. |
||
loadMapping(array $attributes)
Loads a mapping definition from an array. |
from MappingModel | |
array |
getAttributes()
Returns all definition attributes. |
from MappingModel |
mixed |
getAttribute(string $name, mixed $default = null)
Returns a particular attribute by a case-insensitive name. |
from MappingModel |
appendXml(DOMNode $node)
Appends DOM elements to represent this object in XML. |
||
VendorInfo |
addVendorInfo(VendorInfo|array $vendor)
Adds a new VendorInfo instance to this current model object. |
from MappingModel |
VendorInfo |
getVendorInfoForType(string $type)
Returns a VendorInfo object by its type. |
from MappingModel |
string |
getConfiguredBehavior(string $behavior)
Returns the best class name for a given behavior. |
from MappingModel |
string |
toString()
String representation of the current object. |
from MappingModel |
string |
__toString()
String representation of the current object. |
from MappingModel |
string |
normalizeFKey(string $behavior)
Returns the normalized input of onDelete and onUpdate behaviors. |
|
boolean |
hasOnUpdate()
Returns whether or not the onUpdate behavior is set. |
|
boolean |
hasOnDelete()
Returns whether or not the onDelete behavior is set. |
|
string |
getOnUpdate()
Returns the onUpdate behavior. |
|
string |
getOnDelete()
Returns the onDelete behavior. |
|
setOnDelete(string $behavior)
Sets the onDelete behavior. |
||
setOnUpdate(string $behavior)
Sets the onUpdate behavior. |
||
string |
getName()
Returns the foreign key name. |
|
setName(string $name)
Sets the foreign key name. |
||
string |
getPhpName()
Returns the phpName for this foreign key (if any). |
|
setPhpName(string $name)
Sets a phpName to use for this foreign key. |
||
string |
getRefPhpName()
Returns the refPhpName for this foreign key (if any). |
|
setRefPhpName(string $name)
Sets a refPhpName to use for this foreign key. |
||
string |
getDefaultJoin()
Returns the default join strategy for this foreign key (if any). |
|
setDefaultJoin(string $join)
Sets the default join strategy for this foreign key (if any). |
||
string |
getForeignTableName()
Returns the foreign table name of the FK. |
|
string |
getForeignTableCommonName()
Returns the foreign table name without schema. |
|
setForeignTableCommonName(string $tableName)
Sets the foreign table common name of the FK. |
||
Table |
getForeignTable()
Returns the resolved foreign Table model object. |
|
string |
getForeignSchemaName()
Returns the foreign schema name of the FK. |
|
setForeignSchemaName(string $schemaName)
Set the foreign schema name of the foreign key. |
||
setTable(Table $parent)
Sets the parent Table of the foreign key. |
||
Table |
getTable()
Returns the parent Table of the foreign key. |
|
string |
getTableName()
Returns the name of the table the foreign key is in. |
|
string |
getSchemaName()
Returns the name of the schema the foreign key is in. |
|
addReference(mixed $ref1, mixed $ref2 = null)
Adds a new reference entry to the foreign key. |
||
clearReferences()
Clears the references of this foreign key. |
||
array |
getLocalColumns()
Returns an array of local column names. |
|
array |
getLocalColumnObjects()
Returns an array of local column objects. |
|
string |
getLocalColumnName(integer $index)
Returns a local column name identified by a position. |
|
Column |
getLocalColumn(integer $index)
Returns a local Column object identified by a position. |
|
array |
getLocalForeignMapping()
Returns an array of local column to foreign column mapping for this foreign key. |
|
array |
getForeignLocalMapping()
Returns an array of local column to foreign column mapping for this foreign key. |
|
array |
getColumnObjectsMapping()
Returns an array of local and foreign column objects mapped for this foreign key. |
|
string |
getMappedForeignColumn(string $local)
Returns the foreign column name mapped to a specified local column. |
|
string |
getMappedLocalColumn(string $foreign)
Returns the local column name mapped to a specified foreign column. |
|
array |
getForeignColumns()
Returns an array of foreign column names. |
|
array |
getForeignColumnObjects()
Returns an array of foreign column objects. |
|
string |
getForeignColumnName(integer $index)
Returns a foreign column name. |
|
Column |
getForeignColumn($index)
Returns a foreign column object. |
|
boolean |
isLocalColumnsRequired()
Returns whether this foreign key uses a required column, or a list of required columns. |
|
boolean |
isForeignPrimaryKey()
Returns whether this foreign key is also the primary key of the foreign table. |
|
boolean |
isComposite()
Returns whether or not this foreign key relies on more than one column binding. |
|
boolean |
isLocalPrimaryKey()
Returns whether or not this foreign key is also the primary key of the local table. |
|
setSkipSql(boolean $skip)
Sets whether or not this foreign key should have its creation SQL generated. |
||
boolean |
isSkipSql()
Returns whether or not the SQL generation must be skipped for this foreign key. |
|
boolean |
isMatchedByInverseFK()
Whether this foreign key is matched by an inverted foreign key (on foreign table). |
|
getInverseFK() | ||
array |
getOtherFks()
Returns the list of other foreign keys starting on the same table. |
|
boolean |
isAtLeastOneForeignPrimaryKey()
Whether at least one foreign column is also the primary key of the foreign table. |
|
array |
getForeignPrimaryKeys()
Returns all foreign columns which are also a primary key of the foreign table. |
|
boolean |
isAtLeastOneLocalPrimaryKey()
Whether at least one local column is also a primary key. |
Details
at line 54
public
__construct(string $name = null)
Constructs a new ForeignKey object.
in MappingModel at line 38
public
loadMapping(array $attributes)
Loads a mapping definition from an array.
in MappingModel at line 58
public array
getAttributes()
Returns all definition attributes.
All attribute names (keys) are lowercase.
in MappingModel at line 73
public mixed
getAttribute(string $name, mixed $default = null)
Returns a particular attribute by a case-insensitive name.
If the attribute is not set, then the second default value is
returned instead.
at line 713
public
appendXml(DOMNode $node)
Appends DOM elements to represent this object in XML.
in MappingModel at line 138
public VendorInfo
addVendorInfo(VendorInfo|array $vendor)
Adds a new VendorInfo instance to this current model object.
in MappingModel at line 158
public VendorInfo
getVendorInfoForType(string $type)
Returns a VendorInfo object by its type.
in MappingModel at line 176
public string
getConfiguredBehavior(string $behavior)
Returns the best class name for a given behavior.
If not found, the method tries to autoload \Propel\Generator\Behavior\[Bname]\[Bname]Behavior
in MappingModel at line 198
public string
toString()
String representation of the current object.
in MappingModel at line 213
public string
__toString()
String representation of the current object.
at line 93
public string
normalizeFKey(string $behavior)
Returns the normalized input of onDelete and onUpdate behaviors.
at line 117
public boolean
hasOnUpdate()
Returns whether or not the onUpdate behavior is set.
at line 127
public boolean
hasOnDelete()
Returns whether or not the onDelete behavior is set.
at line 137
public string
getOnUpdate()
Returns the onUpdate behavior.
at line 147
public string
getOnDelete()
Returns the onDelete behavior.
at line 157
public
setOnDelete(string $behavior)
Sets the onDelete behavior.
at line 167
public
setOnUpdate(string $behavior)
Sets the onUpdate behavior.
at line 177
public string
getName()
Returns the foreign key name.
at line 187
public
setName(string $name)
Sets the foreign key name.
at line 197
public string
getPhpName()
Returns the phpName for this foreign key (if any).
at line 207
public
setPhpName(string $name)
Sets a phpName to use for this foreign key.
at line 217
public string
getRefPhpName()
Returns the refPhpName for this foreign key (if any).
at line 227
public
setRefPhpName(string $name)
Sets a refPhpName to use for this foreign key.
at line 237
public string
getDefaultJoin()
Returns the default join strategy for this foreign key (if any).
at line 247
public
setDefaultJoin(string $join)
Sets the default join strategy for this foreign key (if any).
at line 257
public string
getForeignTableName()
Returns the foreign table name of the FK.
at line 271
public string
getForeignTableCommonName()
Returns the foreign table name without schema.
at line 281
public
setForeignTableCommonName(string $tableName)
Sets the foreign table common name of the FK.
at line 291
public Table
getForeignTable()
Returns the resolved foreign Table model object.
at line 301
public string
getForeignSchemaName()
Returns the foreign schema name of the FK.
at line 311
public
setForeignSchemaName(string $schemaName)
Set the foreign schema name of the foreign key.
at line 321
public
setTable(Table $parent)
Sets the parent Table of the foreign key.
at line 331
public Table
getTable()
Returns the parent Table of the foreign key.
at line 341
public string
getTableName()
Returns the name of the table the foreign key is in.
at line 351
public string
getSchemaName()
Returns the name of the schema the foreign key is in.
at line 362
public
addReference(mixed $ref1, mixed $ref2 = null)
Adds a new reference entry to the foreign key.
at line 396
public
clearReferences()
Clears the references of this foreign key.
at line 407
public array
getLocalColumns()
Returns an array of local column names.
at line 417
public array
getLocalColumnObjects()
Returns an array of local column objects.
at line 433
public string
getLocalColumnName(integer $index)
Returns a local column name identified by a position.
at line 444
public Column
getLocalColumn(integer $index)
Returns a local Column object identified by a position.
at line 455
public array
getLocalForeignMapping()
Returns an array of local column to foreign column mapping for this foreign key.
at line 471
public array
getForeignLocalMapping()
Returns an array of local column to foreign column mapping for this foreign key.
at line 487
public array
getColumnObjectsMapping()
Returns an array of local and foreign column objects mapped for this foreign key.
at line 507
public string
getMappedForeignColumn(string $local)
Returns the foreign column name mapped to a specified local column.
at line 520
public string
getMappedLocalColumn(string $foreign)
Returns the local column name mapped to a specified foreign column.
at line 532
public array
getForeignColumns()
Returns an array of foreign column names.
at line 542
public array
getForeignColumnObjects()
Returns an array of foreign column objects.
at line 559
public string
getForeignColumnName(integer $index)
Returns a foreign column name.
at line 569
public Column
getForeignColumn($index)
Returns a foreign column object.
at line 580
public boolean
isLocalColumnsRequired()
Returns whether this foreign key uses a required column, or a list of required columns.
at line 597
public boolean
isForeignPrimaryKey()
Returns whether this foreign key is also the primary key of the foreign table.
at line 623
public boolean
isComposite()
Returns whether or not this foreign key relies on more than one column binding.
at line 634
public boolean
isLocalPrimaryKey()
Returns whether or not this foreign key is also the primary key of the local table.
at line 650
public
setSkipSql(boolean $skip)
Sets whether or not this foreign key should have its creation SQL generated.
at line 661
public boolean
isSkipSql()
Returns whether or not the SQL generation must be skipped for this foreign key.
at line 676
public boolean
isMatchedByInverseFK()
Whether this foreign key is matched by an inverted foreign key (on foreign table).
This is to prevent duplicate columns being generated for a 1:1 relationship that is represented
by foreign keys on both tables. I don't know if that's good practice ... but hell, why not
support it.
at line 681
public
getInverseFK()
at line 701
public array
getOtherFks()
Returns the list of other foreign keys starting on the same table.
Used in many-to-many relationships.
at line 761
public boolean
isAtLeastOneForeignPrimaryKey()
Whether at least one foreign column is also the primary key of the foreign table.
at line 773
public array
getForeignPrimaryKeys()
Returns all foreign columns which are also a primary key of the foreign table.
at line 799
public boolean
isAtLeastOneLocalPrimaryKey()
Whether at least one local column is also a primary key.