#PHRAS-888 time 5m

rollback (double record instantiation was ok)
This commit is contained in:
Jean-Yves Gaulier
2016-01-06 14:59:13 +01:00
parent f2d94dc667
commit f4c834d68c
3 changed files with 4 additions and 25 deletions

View File

@@ -250,7 +250,7 @@ class databox extends base implements ThumbnailedElement
*/
public function get_record($record_id, $number = null)
{
return record_adapter::getRecordLoaded($this->app, $this->id, $record_id, $number);
return new record_adapter($this->app, $this->id, $record_id, $number);
}
public function get_label($code, $substitute = true)

View File

@@ -107,28 +107,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$this->mirror($record);
}
/**
* returns a loaded record, same thing as calling new record_adapter(..., load=true)
* but does instantiate only one record, no need to mirror().
*
* @param Application $app
* @param $sbas_id
* @param $record_id
* @param null $number
*
* @return null|record_adapter
*/
public static function getRecordLoaded(Application $app, $sbas_id, $record_id, $number = null)
{
if (null === ($record = $app->findDataboxById((int) $sbas_id)->getRecordRepository()->find($record_id))) {
throw new Exception_Record_AdapterNotFound('Record ' . $record_id . ' on database ' . $sbas_id . ' not found ');
}
$record->app = $app;
$record->number = $number;
return $record;
}
/**
* @param record_adapter $record
*/