Пример #1
0
 /**
  * Exclude object from result
  *
  * @param   ChildUserGroup $userGroup Object to remove from the list of results
  *
  * @return $this|ChildUserGroupQuery The current query, for fluid interface
  */
 public function prune($userGroup = null)
 {
     if ($userGroup) {
         $this->addCond('pruneCond0', $this->getAliasedColName(UserGroupTableMap::COL_USER_ID), $userGroup->getUserId(), Criteria::NOT_EQUAL);
         $this->addCond('pruneCond1', $this->getAliasedColName(UserGroupTableMap::COL_GROUP_ID), $userGroup->getGroupId(), Criteria::NOT_EQUAL);
         $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
     }
     return $this;
 }
Пример #2
0
 /**
  * Filter the query by a related \keeko\core\model\UserGroup object
  *
  * @param \keeko\core\model\UserGroup|ObjectCollection $userGroup the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildGroupQuery The current query, for fluid interface
  */
 public function filterByUserGroup($userGroup, $comparison = null)
 {
     if ($userGroup instanceof \keeko\core\model\UserGroup) {
         return $this->addUsingAlias(GroupTableMap::COL_ID, $userGroup->getGroupId(), $comparison);
     } elseif ($userGroup instanceof ObjectCollection) {
         return $this->useUserGroupQuery()->filterByPrimaryKeys($userGroup->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByUserGroup() only accepts arguments of type \\keeko\\core\\model\\UserGroup or Collection');
     }
 }
Пример #3
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database. In some cases you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by find*()
  * and findPk*() calls.
  *
  * @param \keeko\core\model\UserGroup $obj A \keeko\core\model\UserGroup object.
  * @param string $key             (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if (null === $key) {
             $key = serialize(array((string) $obj->getUserId(), (string) $obj->getGroupId()));
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Пример #4
0
 /**
  * Remove group of this object
  * through the kk_user_group cross reference table.
  *
  * @param ChildGroup $group
  * @return ChildUser The current object (for fluent API support)
  */
 public function removeGroup(ChildGroup $group)
 {
     if ($this->getGroups()->contains($group)) {
         $userGroup = new ChildUserGroup();
         $userGroup->setGroup($group);
         if ($group->isUsersLoaded()) {
             //remove the back reference if available
             $group->getUsers()->removeObject($this);
         }
         $userGroup->setUser($this);
         $this->removeUserGroup(clone $userGroup);
         $userGroup->clear();
         $this->collGroups->remove($this->collGroups->search($group));
         if (null === $this->groupsScheduledForDeletion) {
             $this->groupsScheduledForDeletion = clone $this->collGroups;
             $this->groupsScheduledForDeletion->clear();
         }
         $this->groupsScheduledForDeletion->push($group);
     }
     return $this;
 }