/** * Checks if the specified photo exists in the database already and returns * it if it does. * * @param string $path The storage path of the photo * @param \Photo\Model\Album $album the album the photo is in * @return \Photo\Model\Photo|null */ public function getPhotoByData($path, $album) { return $this->getRepository()->findOneBy(['path' => $path, 'album' => $album->getId()]); }