Created
September 5, 2012 12:16
-
-
Save pronskiy/3635771 to your computer and use it in GitHub Desktop.
Yii CActiveRecord dynamic relation adding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$class = CActiveRecord::HAS_MANY; // Или любой другой вид отношений (HAS_ONE, BELONGS_TO, MANY_MANY) | |
$model->getMetaData()->relations[$relationName] = | |
new $class( | |
$relationName, | |
$className, | |
$foreignKey, | |
$options | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment