0

I somehow can't get this to work. I had it working, messed up my php server & had no backups from the working version... I guess I had a similar solution.

public function schreibenAction() {
  $user = $this->getDoctrine()
          ->getRepository('AppBundle:User')
          ->find(1); //How can I search for the currently logged user?

  if (!$user) {
      throw $this->createNotFoundException(
              'No user found for id 1'
      );
  }

  $path = $user->getPath();
  return $this->render('default/unterlagen/schreiben.html.twig', array(
              'path' => $path,
    ));
}

I need the path value from the database..

SELECT t0.id AS id_1, t0.username AS username_2, t0.password AS password_3, t0.path AS path_4, t0.is_active AS is_active_5 FROM app_users t0 WHERE t0.id = ?

1 Answer 1

1

You can get currently logged user with $this->getUser() in your controller. Look at this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.