mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Merge pull request #499 from romainneutron/fix-1309
[3.8] Fix #1309 : Stories can not be removed
This commit is contained in:
@@ -218,14 +218,14 @@ class Records implements ControllerProviderInterface
|
||||
$deleted[] = $element->getRecord($app)->get_serialize_key();
|
||||
}
|
||||
|
||||
$attachedStories = $StoryWZRepository->findByRecord($record);
|
||||
$attachedStories = $StoryWZRepository->findByRecord($app, $record);
|
||||
|
||||
foreach ($attachedStories as $attachedStory) {
|
||||
$app['EM']->remove($attachedStory);
|
||||
}
|
||||
|
||||
$record->delete();
|
||||
$deleted[] = $record->get_serialize_key();
|
||||
$record->delete();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ class StoryWZRepository extends EntityRepository
|
||||
return $story;
|
||||
}
|
||||
|
||||
public function findByRecord(\record_adapter $Story)
|
||||
public function findByRecord(Application $app, \record_adapter $Story)
|
||||
{
|
||||
$dql = 'SELECT s FROM Entities\StoryWZ s WHERE s.sbas_id = :sbas_id
|
||||
AND s.record_id = :record_id';
|
||||
@@ -122,7 +122,7 @@ class StoryWZRepository extends EntityRepository
|
||||
|
||||
foreach ($stories as $key => $story) {
|
||||
try {
|
||||
$record = $story->getRecord();
|
||||
$record = $story->getRecord($app);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
$this->getEntityManager()->remove($story);
|
||||
$this->getEntityManager()->flush();
|
||||
@@ -133,7 +133,7 @@ class StoryWZRepository extends EntityRepository
|
||||
return $stories;
|
||||
}
|
||||
|
||||
public function findByDatabox(\databox $databox)
|
||||
public function findByDatabox(Application $app, \databox $databox)
|
||||
{
|
||||
$dql = 'SELECT s FROM Entities\StoryWZ s WHERE s.sbas_id = :sbas_id';
|
||||
|
||||
@@ -146,7 +146,7 @@ class StoryWZRepository extends EntityRepository
|
||||
|
||||
foreach ($stories as $key => $story) {
|
||||
try {
|
||||
$record = $story->getRecord();
|
||||
$record = $story->getRecord($app);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
$this->getEntityManager()->remove($story);
|
||||
$this->getEntityManager()->flush();
|
||||
|
@@ -452,7 +452,7 @@ class databox extends base
|
||||
$n+=50;
|
||||
}
|
||||
|
||||
foreach ($this->app['EM']->getRepository('\Entities\StoryWZ')->findByDatabox($this) as $story) {
|
||||
foreach ($this->app['EM']->getRepository('\Entities\StoryWZ')->findByDatabox($this->app, $this) as $story) {
|
||||
$this->app['EM']->remove($story);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user