コード例 #1
0
 /**
  * Filter the query by a related \Jalle19\StatusManager\Database\User object
  *
  * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user 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 filterByUser($user, $comparison = null)
 {
     if ($user instanceof \Jalle19\StatusManager\Database\User) {
         return $this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $user->getId(), $comparison);
     } elseif ($user instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type \\Jalle19\\StatusManager\\Database\\User or Collection');
     }
 }
コード例 #2
0
 /**
  * @param Instance           $instance
  * @param User|null          $user
  * @param Channel            $channel
  * @param SubscriptionStatus $subscription
  *
  * @return bool
  * @throws \Propel\Runtime\Exception\PropelException
  */
 public function hasSubscription(Instance $instance, $user, Channel $channel, SubscriptionStatus $subscription)
 {
     // Not all subscriptions are tied to a user
     $userId = $user !== null ? $user->getId() : null;
     return $this->filterByInstance($instance)->filterByUserId($userId)->filterByChannel($channel)->filterBySubscriptionId($subscription->id)->filterByStarted($subscription->start)->findOne() !== null;
 }
コード例 #3
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->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);
 }
コード例 #4
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->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);
 }
コード例 #5
0
 /**
  * Filter the query by a related \Jalle19\StatusManager\Database\User object
  *
  * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildInstanceQuery The current query, for fluid interface
  */
 public function filterByUser($user, $comparison = null)
 {
     if ($user instanceof \Jalle19\StatusManager\Database\User) {
         return $this->addUsingAlias(InstanceTableMap::COL_NAME, $user->getInstanceName(), $comparison);
     } elseif ($user instanceof ObjectCollection) {
         return $this->useUserQuery()->filterByPrimaryKeys($user->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type \\Jalle19\\StatusManager\\Database\\User or Collection');
     }
 }
コード例 #6
0
 /**
  * @param ChildUser $user The ChildUser object to add.
  */
 protected function doAddUser(ChildUser $user)
 {
     $this->collUsers[] = $user;
     $user->setInstance($this);
 }
コード例 #7
0
 /**
  * @param string $instanceName
  * @param string $userName
  *
  * @throws \Propel\Runtime\Exception\PropelException
  */
 private function onUserSeen($instanceName, $userName)
 {
     if (UserQuery::create()->hasUser($instanceName, $userName)) {
         return;
     }
     $user = new User();
     $user->setInstanceName($instanceName)->setName($userName);
     $user->save();
     $this->logger->info('Stored new user (instance: {instanceName}, username: {userName})', ['instanceName' => $instanceName, 'userName' => $userName]);
 }
コード例 #8
0
 /**
  * Exclude object from result
  *
  * @param   ChildUser $user Object to remove from the list of results
  *
  * @return $this|ChildUserQuery The current query, for fluid interface
  */
 public function prune($user = null)
 {
     if ($user) {
         $this->addUsingAlias(UserTableMap::COL_ID, $user->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }