Created
October 19, 2012 18:01
-
-
Save davialexandre/3919660 to your computer and use it in GitHub Desktop.
Relations - exemplos
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
<?php | |
class Os extends CActiveRecord { | |
public function relations() { | |
return array( | |
'cliente' => array(self::BELONGS_TO, 'Cliente', 'id_cliente'), | |
); | |
} | |
} | |
$os = Os::model()->findByPk(1); | |
echo $os->cliente->nome_fantasia; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment