/** * @param $hash * @param $teaser * @return null|Aggregation */ public function findOrCreateByHash($hash, $teaser) { /** * @var Aggregation $aggregation */ $aggregation = $this->source->findByHash($hash); if (empty($aggregation)) { $aggregation = $this->source->create(['exception_hash' => $hash, 'exception_teaser' => $teaser]); $this->source->save($aggregation); } return $aggregation; }