Ejemplo n.º 1
0
 /**
  * Filter the query by a related \keeko\core\model\User object
  *
  * @param \keeko\core\model\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 ChildJudgeQuery The current query, for fluid interface
  */
 public function filterByUser($user, $comparison = null)
 {
     if ($user instanceof \keeko\core\model\User) {
         return $this->addUsingAlias(JudgeTableMap::COL_USER_ID, $user->getId(), $comparison);
     } elseif ($user instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(JudgeTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type \\keeko\\core\\model\\User or Collection');
     }
 }
Ejemplo n.º 2
0
 /**
  * Declares an association between this object and a ChildUser object.
  *
  * @param  ChildUser $v
  * @return $this|\keeko\core\model\Session The current object (for fluent API support)
  * @throws PropelException
  */
 public function setUser(ChildUser $v = null)
 {
     if ($v === null) {
         $this->setUserId(NULL);
     } else {
         $this->setUserId($v->getId());
     }
     $this->aUser = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildUser object, it will not be re-added.
     if ($v !== null) {
         $v->addSession($this);
     }
     return $this;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 /**
  *
  * @param User $user
  * @return Session|null
  */
 private function findSession(User $user)
 {
     $request = Request::createFromGlobals();
     $ua = $request->headers->get('User-Agent');
     $detector = new DeviceDetector($ua);
     $detector->skipBotDetection(true);
     $detector->parse();
     return SessionQuery::create()->filterByUserId($user->getId())->filterByBrowser($detector->getClient('name'))->filterByOs($detector->getOs('name'))->findOne();
 }
Ejemplo n.º 5
0
 private function isGuest(User $user)
 {
     return $user->getId() === -1;
 }