thrownewDoctrine_Record_Exception("Unknown property / related component '$name'.");
}
// one-to-many or one-to-one relation
if($relinstanceofDoctrine_ForeignKey||
$relinstanceofDoctrine_LocalKey){
switch($rel->getType()):
caseDoctrine_Relation::MANY_COMPOSITE:
caseDoctrine_Relation::MANY_AGGREGATE:
// one-to-many relation found
if(!($valueinstanceofDoctrine_Collection))
thrownewDoctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
$value->setReference($this,$rel);
break;
caseDoctrine_Relation::ONE_COMPOSITE:
caseDoctrine_Relation::ONE_AGGREGATE:
// one-to-one relation found
if(!($valueinstanceofDoctrine_Record))
thrownewDoctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record when setting one-to-one references.");
thrownewDoctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
}
}
publicfunctioncoreSetRelated($name,$value){
$rel=$this->table->getRelation($name);
// one-to-many or one-to-one relation
if($relinstanceofDoctrine_ForeignKey||
$relinstanceofDoctrine_LocalKey){
switch($rel->getType()){
caseDoctrine_Relation::MANY_COMPOSITE:
caseDoctrine_Relation::MANY_AGGREGATE:
// one-to-many relation found
if(!($valueinstanceofDoctrine_Collection))
thrownewDoctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");
$value->setReference($this,$rel);
break;
caseDoctrine_Relation::ONE_COMPOSITE:
caseDoctrine_Relation::ONE_AGGREGATE:
// one-to-one relation found
if(!($valueinstanceofDoctrine_Record))
thrownewDoctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record when setting one-to-one references.");
thrownewDoctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.");