/** * @param InstanceSeenEvent $event * * @throws \Propel\Runtime\Exception\PropelException */ public function onInstanceSeen(InstanceSeenEvent $event) { $instance = $event->getInstance(); if (InstanceQuery::create()->hasInstance($instance)) { return; } $instanceModel = new Database\Instance(); $instanceModel->setPrimaryKey($instance->getName()); $instanceModel->save(); $this->logger->info('Stored new instance {instanceName}', ['instanceName' => $instance->getName()]); // Create a special user for eventual DVR subscriptions $user = new User(); $user->setInstance($instanceModel); $user->setName(User::NAME_DVR); $user->save(); $this->logger->info('Stored new special user (instance: {instanceName}, user: {userName})', ['instanceName' => $instance->getName(), 'userName' => $user->getName()]); }
/** * @param ChildUser $user The ChildUser object to add. */ protected function doAddUser(ChildUser $user) { $this->collUsers[] = $user; $user->setInstance($this); }