userManager = $userManager; $this->dbConnection = $dbConnection; } protected function configure() { $this ->setName('dav:create-calendar') ->setDescription('Create a dav calendar') ->addArgument('user', InputArgument::REQUIRED, 'User for whom the calendar will be created') ->addArgument('name', InputArgument::REQUIRED, 'Name of the calendar'); } protected function execute(InputInterface $input, OutputInterface $output) { $user = $input->getArgument('user'); if (!$this->userManager->userExists($user)) { throw new \InvalidArgumentException("User <$user> in unknown."); } $name = $input->getArgument('name'); $caldav = new CalDavBackend($this->dbConnection); $caldav->createCalendar("principals/users/$user", $name, []); } }