/** * This method is called on the presenter lifecycle begin, * so we can put here code that would be duplicated among the action methods. * * Also, this is a good place to add some common checks that apply to all presenter actions. */ protected function startup() { parent::startup(); // so we don't have to repeat the code in every action if ($id = $this->getParameter('id')) { $this->note = $this->noteRepository->findOneBy(['id' => $id, 'user' => $this->user->getId()]); if (!$this->note) { $this->error(); } } if ($padId = $this->getParameter('pad')) { $this->pad = $this->padRepository->findOneBy(['id' => $padId, 'user' => $this->user->getId()]); if (!$this->pad) { $this->error(); } } }