Changeset 5767
- Timestamp:
- 10/30/07 19:58:41 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php
r3525 r5767 173 173 protected $current_i18n = array(); 174 174 175 public function getCurrent'.$className.'() 176 { 177 if (!isset($this->current_i18n[$this->culture])) 178 { 179 $obj = '.$className.'Peer::retrieveByPK($this->get'.$pk.'(), $this->culture); 175 public function getCurrent'.$className.'($culture = null) 176 { 177 if (is_null($culture)) 178 { 179 if (is_null($this->culture)) 180 { 181 throw new PropelException(sprintf(\'No culture is set for this "%s" object.\', get_class($this))); 182 } 183 184 $culture = $this->culture; 185 } 186 187 if (!isset($this->current_i18n[$culture])) 188 { 189 $obj = '.$className.'Peer::retrieveByPK($this->get'.$pk.'(), $culture); 180 190 if ($obj) 181 191 { 182 $this->set'.$className.'ForCulture($obj, $ this->culture);192 $this->set'.$className.'ForCulture($obj, $culture); 183 193 } 184 194 else 185 195 { 186 $this->set'.$className.'ForCulture(new '.$className.'(), $ this->culture);187 $this->current_i18n[$ this->culture]->set'.$culture.'($this->culture);188 } 189 } 190 191 return $this->current_i18n[$ this->culture];196 $this->set'.$className.'ForCulture(new '.$className.'(), $culture); 197 $this->current_i18n[$culture]->set'.$culture.'($culture); 198 } 199 } 200 201 return $this->current_i18n[$culture]; 192 202 } 193 203 … … 231 241 { 232 242 $foreign_tables_i18n_table = $this->getDatabase()->getTable($foreign_table->getAttribute('i18nTable')); 233 $value .= ' || $this->'.$matches[2].'->getCurrent'.$foreign_tables_i18n_table->getPhpName().'()->isModified()';243 $value .= ' || ($this->'.$matches[2].'->getCulture() && $this->'.$matches[2].'->getCurrent'.$foreign_tables_i18n_table->getPhpName().'()->isModified())'; 234 244 } 235 245