mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
- fix : better simple cache
This commit is contained in:
@@ -579,39 +579,37 @@ class databox extends base implements ThumbnailedElement
|
|||||||
/**
|
/**
|
||||||
* @return int[]
|
* @return int[]
|
||||||
*/
|
*/
|
||||||
|
private $_collection_unique_ids = null;
|
||||||
public function get_collection_unique_ids()
|
public function get_collection_unique_ids()
|
||||||
{
|
{
|
||||||
static $_r = null;
|
if($this->_collection_unique_ids === null) {
|
||||||
|
$this->_collection_unique_ids = [];
|
||||||
if($_r === null) {
|
|
||||||
$_r = [];
|
|
||||||
|
|
||||||
foreach ($this->get_collections() as $collection) {
|
foreach ($this->get_collections() as $collection) {
|
||||||
$_r[] = $collection->get_base_id();
|
$this->_collection_unique_ids[] = $collection->get_base_id();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $_r;
|
return $this->_collection_unique_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return collection[]
|
* @return collection[]
|
||||||
*/
|
*/
|
||||||
|
private $_collections = null;
|
||||||
public function get_collections()
|
public function get_collections()
|
||||||
{
|
{
|
||||||
static $_r = null;
|
if($this->_collections === null) {
|
||||||
|
|
||||||
if($_r === null) {
|
|
||||||
/** @var CollectionRepositoryRegistry $repositoryRegistry */
|
/** @var CollectionRepositoryRegistry $repositoryRegistry */
|
||||||
$repositoryRegistry = $this->app['repo.collections-registry'];
|
$repositoryRegistry = $this->app['repo.collections-registry'];
|
||||||
$repository = $repositoryRegistry->getRepositoryByDatabox($this->get_sbas_id());
|
$repository = $repositoryRegistry->getRepositoryByDatabox($this->get_sbas_id());
|
||||||
|
|
||||||
$_r = array_filter($repository->findAll(), function (collection $collection) {
|
$this->_collections = array_filter($repository->findAll(), function (collection $collection) {
|
||||||
return $collection->is_active();
|
return $collection->is_active();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return $_r;
|
return $this->_collections;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Reference in New Issue
Block a user