/** * Set the id * * @param PostId $id * @return void */ private function setId(PostId $id) { $this->id = $id->toString(); }
/** * Find a Post by it's id * * @param PostId $id * @return Post */ public function postOfId(PostId $id) { return $this->em->getRepository($this->class)->findOneBy(['id' => $id->toString()]); }