mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
#PHRAS-888 time 5m
rollback (double record instantiation was ok)
This commit is contained in:
@@ -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)
|
||||
|
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user