mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
Add delete method on databox repositories to invalidate cache on delete
This commit is contained in:
@@ -62,6 +62,16 @@ class ArrayCacheDataboxRepository implements DataboxRepository
|
|||||||
return $this->repository->save($databox);
|
return $this->repository->save($databox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \databox $databox
|
||||||
|
*/
|
||||||
|
public function delete(\databox $databox)
|
||||||
|
{
|
||||||
|
$this->clear();
|
||||||
|
|
||||||
|
return $this->repository->delete($databox);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $host
|
* @param $host
|
||||||
* @param $port
|
* @param $port
|
||||||
|
@@ -69,6 +69,13 @@ final class CachingDataboxRepositoryDecorator implements DataboxRepository
|
|||||||
return $this->repository->save($databox);
|
return $this->repository->save($databox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete(\databox $databox)
|
||||||
|
{
|
||||||
|
$this->clearCache();
|
||||||
|
|
||||||
|
return $this->repository->delete($databox);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $host
|
* @param $host
|
||||||
* @param $port
|
* @param $port
|
||||||
|
@@ -27,6 +27,11 @@ interface DataboxRepository
|
|||||||
*/
|
*/
|
||||||
public function save(\databox $databox);
|
public function save(\databox $databox);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \databox $databox
|
||||||
|
*/
|
||||||
|
public function delete(\databox $databox);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $host
|
* @param $host
|
||||||
* @param $port
|
* @param $port
|
||||||
|
@@ -56,6 +56,11 @@ final class DbalDataboxRepository implements DataboxRepository
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete(\databox $databox)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return false|array
|
* @return false|array
|
||||||
|
@@ -935,6 +935,8 @@ class databox extends base implements ThumbnailedElement
|
|||||||
|
|
||||||
$this->get_appbox()->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
$this->get_appbox()->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||||
|
|
||||||
|
$this->databoxRepository->delete($this);
|
||||||
|
|
||||||
$this->app['dispatcher']->dispatch(
|
$this->app['dispatcher']->dispatch(
|
||||||
DataboxEvents::DELETED,
|
DataboxEvents::DELETED,
|
||||||
new DeletedEvent(
|
new DeletedEvent(
|
||||||
|
Reference in New Issue
Block a user