I'm trying to make one to one unidirectionnal. The problem is, it does not work. Here is my entities:
class A extends CActiveRecord {
public function relations() {
return array(
'logbook' => array(self::BELONGS_TO, 'Logbook', 'logbook_id'),
);
}
public static function model($className = __CLASS__) {
return parent::model($className);
}
}
?>
class Logbook extends CActiveRecord {
public static function model($className = __CLASS__) {
return parent::model($className);
}
}
I'm doing this:
$a = new A(); $b = new Logbook(); $a->logbook = $b; $a->save();
But the foreign key 'logbook_id' is not set! And logbook has not been persisted.
Need some help please.

Help












