/**
  * @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()]);
 }
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aInstance) {
         $this->aInstance->removeChannel($this);
     }
     $this->id = null;
     $this->instance_name = null;
     $this->name = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
  *
  * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildConnectionQuery The current query, for fluid interface
  */
 public function filterByInstance($instance, $comparison = null)
 {
     if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
         return $this->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
     } elseif ($instance instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
     } else {
         throw new PropelException('filterByInstance() only accepts arguments of type \\Jalle19\\StatusManager\\Database\\Instance or Collection');
     }
 }
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aInstance) {
         $this->aInstance->removeConnection($this);
     }
     if (null !== $this->aUser) {
         $this->aUser->removeConnection($this);
     }
     $this->id = null;
     $this->instance_name = null;
     $this->user_id = null;
     $this->peer = null;
     $this->started = null;
     $this->type = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aInstance) {
         $this->aInstance->removeSubscription($this);
     }
     if (null !== $this->aInput) {
         $this->aInput->removeSubscription($this);
     }
     if (null !== $this->aUser) {
         $this->aUser->removeSubscription($this);
     }
     if (null !== $this->aChannel) {
         $this->aChannel->removeSubscription($this);
     }
     $this->id = null;
     $this->instance_name = null;
     $this->input_uuid = null;
     $this->user_id = null;
     $this->channel_id = null;
     $this->subscription_id = null;
     $this->started = null;
     $this->stopped = null;
     $this->title = null;
     $this->service = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * Exclude object from result
  *
  * @param   ChildInstance $instance Object to remove from the list of results
  *
  * @return $this|ChildInstanceQuery The current query, for fluid interface
  */
 public function prune($instance = null)
 {
     if ($instance) {
         $this->addUsingAlias(InstanceTableMap::COL_NAME, $instance->getName(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Esempio n. 7
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aInstance) {
         $this->aInstance->removeInput($this);
     }
     $this->uuid = null;
     $this->instance_name = null;
     $this->started = null;
     $this->input = null;
     $this->network = null;
     $this->mux = null;
     $this->weight = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }