mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-07 18:14:35 +00:00

* add "resource_id" to record / story ; formula defined into InstanceIdAware.php * fix tests * fix tests * switch to main/instance_id
32 lines
696 B
PHP
32 lines
696 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Controller\Api;
|
|
|
|
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
|
|
|
trait InstanceIdAware
|
|
{
|
|
private $instanceId;
|
|
|
|
/**
|
|
* @param PropertyAccess $conf
|
|
* @return InstanceIdAware
|
|
*/
|
|
public function setInstanceId(PropertyAccess $conf)
|
|
{
|
|
$this->instanceId = $conf->get(
|
|
['main', 'instance_id'],
|
|
md5($conf->get(['main', 'key'], ''))
|
|
);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getResourceIdResolver()
|
|
{
|
|
return function(\record_adapter $record): string {
|
|
return $this->instanceId . '_' . $record->getDataboxId() . '_' . $record->getRecordId();
|
|
};
|
|
}
|
|
}
|