Changeset 153
- Timestamp:
- 09/30/09 10:13:43 (6 months ago)
- Files:
-
- 1 modified
-
trunk/class-abstractmodel.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/class-abstractmodel.php
r152 r153 12 12 * - $HeadURL$ 13 13 * @changelog 14 * - 2009-09-29 - bug correction in modelCollection::__get() when getting hasOne relation on foreign unique key 14 15 * - 2009-07-08 - new modelCollection::slice() method 15 16 * - 2009-07-07 - now [r]sort can sort properties get by user defined getter (abstractmodel::getPropertyName()). (don't work for dynamic methods [r]sortPropertyname) … … 396 397 $c = modelCollection::init($hasOne[$k]['modelName']); 397 398 $avoidEmptyPK = abstractModel::_getModelStaticProp($c->collectionType,'_avoidEmptyPK'); 399 if( empty($hasOne[$k]['localField']) ){ //-- must be in presence of unique key field on foreign table 400 return abstractModel::_makeModelStaticCall($hasOne[$k]['modelName'],'getFilteredInstances',array('WHERE '.$hasOne[$k]['foreignField'].' IN (?)',$this->PK)); 401 }else{ 398 402 foreach($this->loadDatas() as $mk=>$m){ 399 $c[] = ($avoidEmptyPK && empty($m->datas[$hasOne[$k]['localField']]))?$m->{$k}:$m->datas[$hasOne[$k]['localField']]; 403 $c[] = ( $avoidEmptyPK && empty($m->datas[$hasOne[$k]['localField']]))?$m->{$k}:$m->datas[$hasOne[$k]['localField']]; 404 } 400 405 } 401 406 return $c;
