*/ class CustomerController implements InitializableControllerInterface { private $user; private $company; public function initialize(Request $request, SecurityContextInterface $security_context) { $this->user = $security_context->getToken()->getUser(); $this->company = $this->user->getCompany(); if (!$this->company) { throw new NotFoundHttpException('You are not assigned to a company.'); } } // ... rest of controller actions }