/** * When ever we find a refClass, it may introduce trouble if it has more fields * than just the two related foreign keys. For such situations valid default * values should be provided. * * @param string $entName The entity name as in record definition config. * @param string $relName The relation name as in record definition config. * @param sfDoctrineRecord $refEntity The new entity acting as a refclass * @param array $recordDef This record definition. * * @return void */ protected static function loadRefEntityDefaults($entName, $relName, sfDoctrineRecord $refEntity, array $recordDef) { if (isset($recordDef['entities'][$entName]['relations'][$relName]['refClassDefaults']) && !empty($recordDef['entities'][$entName]['relations'][$relName]['refClassDefaults'])) { $columns = $recordDef['entities'][$entName]['relations'][$relName]['refClassDefaults']; foreach ($columns as $colName => $defVal) { $refEntity->set($colName, self::getDefault($defVal)); } } }
public function set($name, $value, $load = true) { if (in_array($name, $this->getI18nColumns())) { $obj = $this->getCurrentI18nObject(true); $obj->set($name, $value, $load); } else { parent::set($name, $value, $load); } }