mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Return base_id in API & remove unneeded conversions
This commit is contained in:
@@ -1140,7 +1140,8 @@ class V1Controller extends Controller
|
|||||||
'original_name' => $record->get_original_name(),
|
'original_name' => $record->get_original_name(),
|
||||||
'updated_on' => $record->get_modification_date()->format(DATE_ATOM),
|
'updated_on' => $record->get_modification_date()->format(DATE_ATOM),
|
||||||
'created_on' => $record->get_creation_date()->format(DATE_ATOM),
|
'created_on' => $record->get_creation_date()->format(DATE_ATOM),
|
||||||
'collection_id' => \phrasea::collFromBas($this->app, $record->get_base_id()),
|
'collection_id' => $record->get_collection_id(),
|
||||||
|
'base_id' => $record->get_base_id(),
|
||||||
'sha256' => $record->get_sha256(),
|
'sha256' => $record->get_sha256(),
|
||||||
'thumbnail' => $this->listEmbeddableMedia($request, $record, $record->get_thumbnail()),
|
'thumbnail' => $this->listEmbeddableMedia($request, $record, $record->get_thumbnail()),
|
||||||
'technical_informations' => $technicalInformation,
|
'technical_informations' => $technicalInformation,
|
||||||
|
@@ -37,6 +37,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
protected $xml;
|
protected $xml;
|
||||||
protected $base_id;
|
protected $base_id;
|
||||||
|
protected $collection_id;
|
||||||
protected $record_id;
|
protected $record_id;
|
||||||
protected $mime;
|
protected $mime;
|
||||||
protected $number;
|
protected $number;
|
||||||
@@ -106,6 +107,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
$this->modification_date = $datas['modification_date'];
|
$this->modification_date = $datas['modification_date'];
|
||||||
$this->creation_date = $datas['creation_date'];
|
$this->creation_date = $datas['creation_date'];
|
||||||
$this->base_id = $datas['base_id'];
|
$this->base_id = $datas['base_id'];
|
||||||
|
$this->collection_id = $datas['collection_id'];
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -124,7 +126,8 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
throw new Exception_Record_AdapterNotFound('Record ' . $this->record_id . ' on database ' . $this->databox->get_sbas_id() . ' not found ');
|
throw new Exception_Record_AdapterNotFound('Record ' . $this->record_id . ' on database ' . $this->databox->get_sbas_id() . ' not found ');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->base_id = (int) phrasea::baseFromColl($this->databox->get_sbas_id(), $row['coll_id'], $this->app);
|
$this->collection_id = $row['coll_id'];
|
||||||
|
$this->base_id = (int) phrasea::baseFromColl($this->databox->get_sbas_id(), $this->collection_id, $this->app);
|
||||||
$this->creation_date = new DateTime($row['credate']);
|
$this->creation_date = new DateTime($row['credate']);
|
||||||
$this->modification_date = new DateTime($row['moddate']);
|
$this->modification_date = new DateTime($row['moddate']);
|
||||||
$this->uuid = $row['uuid'];
|
$this->uuid = $row['uuid'];
|
||||||
@@ -136,15 +139,16 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
$this->mime = $row['mime'];
|
$this->mime = $row['mime'];
|
||||||
|
|
||||||
$datas = [
|
$datas = [
|
||||||
'mime' => $this->mime
|
'mime' => $this->mime,
|
||||||
, 'sha256' => $this->sha256
|
'sha256' => $this->sha256,
|
||||||
, 'original_name' => $this->original_name
|
'original_name' => $this->original_name,
|
||||||
, 'type' => $this->type
|
'type' => $this->type,
|
||||||
, 'grouping' => $this->grouping
|
'grouping' => $this->grouping,
|
||||||
, 'uuid' => $this->uuid
|
'uuid' => $this->uuid,
|
||||||
, 'modification_date' => $this->modification_date
|
'modification_date' => $this->modification_date,
|
||||||
, 'creation_date' => $this->creation_date
|
'creation_date' => $this->creation_date,
|
||||||
, 'base_id' => $this->base_id
|
'base_id' => $this->base_id,
|
||||||
|
'collection_id' => $this->collection_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->set_data_to_cache($datas);
|
$this->set_data_to_cache($datas);
|
||||||
@@ -279,6 +283,16 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
return $this->base_id;
|
return $this->base_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return collection_id of the record
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function get_collection_id()
|
||||||
|
{
|
||||||
|
return $this->collection_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return record collection
|
* Return record collection
|
||||||
*
|
*
|
||||||
@@ -286,7 +300,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function get_collection()
|
public function get_collection()
|
||||||
{
|
{
|
||||||
return \collection::get_from_base_id($this->app, $this->base_id);
|
return \collection::get_from_coll_id($this->app, $this->databox, $this->collection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1468,7 +1482,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
$ftodel[] = $stamp;
|
$ftodel[] = $stamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
$origcoll = phrasea::collFromBas($this->app, $this->get_base_id());
|
$origcoll = $this->collection_id;
|
||||||
|
|
||||||
$xml = $this->app['serializer.caption']->serialize($this->get_caption(), CaptionSerializer::SERIALIZE_XML);
|
$xml = $this->app['serializer.caption']->serialize($this->get_caption(), CaptionSerializer::SERIALIZE_XML);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user