getFKDefinition
Last updated Apr 12th, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn morexPDOObject::getFKDefinition()¶
Get a foreign key definition for a specific classname. This is generally used to lookup classes in a one-to-many relationship with the current object.
Syntax¶
API Docs: http://api.modxcms.com/xpdo/om/xPDOObject.html#getFKDefinition
array getFKDefinition (string $alias)
Examples¶
Get the FK definition of a User who just edited the Document.
$document = $xpdo->getObject('Document',1);
$fkdef = $document->getFKDefinition('EditedBy');
print_r($fkdef);
/* Outputs:
Array (
[class] => User
[key] => editedby
[local] => editedby
[foreign] => id
[cardinality] => one
[owner] => foreign
[type] => aggregate
) */