/** * Find one entry in DB by given id * * @param int $id * @return \Entity\User * @since 1.0 */ public function findOneById($id) { $userData = $this->em->query('SELECT * FROM users WHERE id = ' . $id . ';')->fetch(); $newUser = new UserEntity(); $newUser->setPostRepository($this->em->getPostRepository()); return $this->registerUserEntity($id, $this->mapper->populate($userData, $newUser)); }