private function sportGroupsTypeHandle(Article $a) { if ($a === null) { throw new Exceptions\NullPointerException("Argument event was null"); } try { $coll = new ArrayCollection(); foreach ($a->getGroups() as $ag) { $dbG = $this->sportGroupService->getSportGroup($ag, false); if ($dbG !== null) { $coll->add($dbG); } } $a->setGroups($coll); return $a; } catch (\Exception $ex) { $this->logError($ex->getMessage()); throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }