From 8a73f0c03ef04341f801b720e209eee21240ceaa Mon Sep 17 00:00:00 2001 From: Ghislain Loas <ghislo@sandbox.afi-sa.local> Date: Fri, 1 Jul 2016 14:14:21 +0200 Subject: [PATCH] hotline #42815 fix rt comment --- library/Class/WebService/BibNumerique/Assimil.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/library/Class/WebService/BibNumerique/Assimil.php b/library/Class/WebService/BibNumerique/Assimil.php index dc56d39530b..6113cb3a47d 100644 --- a/library/Class/WebService/BibNumerique/Assimil.php +++ b/library/Class/WebService/BibNumerique/Assimil.php @@ -45,14 +45,13 @@ class Class_WebService_BibNumerique_Assimil extends Class_WebService_BibNumeriqu protected function _deleteNonHarvested() { - if(!$local_ids = - (new Storm_Model_Collection(Class_Album::findAllBy(['type_doc_id' => Class_TypeDoc::ASSIMIL]))) - ->collect('id_origine')) - return $this; - - if($to_delete = array_diff((array) $local_ids, $this->getHarvestedIds())) - (new Storm_Model_Collection(Class_Album::findAllBy(['id_origine' => $to_delete]))) - ->eachDo('delete'); + $harvested_ids = $this->getHarvestedIds(); + (new Storm_Model_Collection(Class_Album::findAllBy(['type_doc_id' => Class_TypeDoc::ASSIMIL]))) + ->reject( + function($album) use($harvested_ids) { + return in_array($album->getIdOrigine(), $harvested_ids); + }) + ->eachDo('delete'); return $this; } -- GitLab