xPDOManager.addConstraint
Last updated not available | 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
$194 per month—let's make that $500!
Learn morexPDOManager::addConstraint¶
Adds a foreign key constraint to the table of a class. The $options array describes the constraint.
Syntax¶
boolean addConstraint (string $class, string $name, [array $options = array()])
Example¶
$manager = $xpdo->getManager();
$manager->addConstraint('MyVendor\\MyPackage\\MyModel', 'owner_fk', array(
'foreign' => 'id',
'local' => 'owner_id',
'constraint' => 'Owner',
));
See Also¶
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
$194 per month—let's make that $500!
Learn more










