Example #1
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->aUser) {
         $this->aUser->removeUserGroup($this);
     }
     if (null !== $this->aGroup) {
         $this->aGroup->removeUserGroup($this);
     }
     $this->user_id = null;
     $this->group_id = null;
     $this->rights = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #2
0
 /**
  * Filter the query by a related \Models\Group object
  *
  * @param \Models\Group|ObjectCollection $group the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildUserQuery The current query, for fluid interface
  */
 public function filterByMyGroup($group, $comparison = null)
 {
     if ($group instanceof \Models\Group) {
         return $this->addUsingAlias(UserTableMap::COL_ID, $group->getOwnerId(), $comparison);
     } elseif ($group instanceof ObjectCollection) {
         return $this->useMyGroupQuery()->filterByPrimaryKeys($group->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByMyGroup() only accepts arguments of type \\Models\\Group or Collection');
     }
 }
Example #3
0
 /**
  * Filter the query by a related \Models\Group object
  *
  * @param \Models\Group|ObjectCollection $group 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 ChildUserGroupQuery The current query, for fluid interface
  */
 public function filterByGroup($group, $comparison = null)
 {
     if ($group instanceof \Models\Group) {
         return $this->addUsingAlias(UserGroupTableMap::COL_GROUP_ID, $group->getId(), $comparison);
     } elseif ($group instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(UserGroupTableMap::COL_GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByGroup() only accepts arguments of type \\Models\\Group or Collection');
     }
 }
Example #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->aUser) {
         $this->aUser->removePackPermission($this);
     }
     if (null !== $this->aGroup) {
         $this->aGroup->removePackPermission($this);
     }
     if (null !== $this->aPack) {
         $this->aPack->removePackPermission($this);
     }
     $this->id = null;
     $this->value = null;
     $this->user_id = null;
     $this->group_id = null;
     $this->pack_id = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #5
0
 /**
  * Exclude object from result
  *
  * @param   ChildGroup $group Object to remove from the list of results
  *
  * @return $this|ChildGroupQuery The current query, for fluid interface
  */
 public function prune($group = null)
 {
     if ($group) {
         $this->addUsingAlias(GroupTableMap::COL_ID, $group->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #6
0
 /**
  * Filter the query by a related \Models\Group object
  *
  * @param \Models\Group $group The related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildSharedQuery The current query, for fluid interface
  */
 public function filterByGroup($group, $comparison = null)
 {
     if ($group instanceof \Models\Group) {
         return $this->addUsingAlias(SharedTableMap::COL_TO_TYPE, 'group', $comparison)->addUsingAlias(SharedTableMap::COL_TO_ID, $group->getId(), $comparison);
     } else {
         throw new PropelException('filterByGroup() only accepts arguments of type \\Models\\Group');
     }
 }
Example #7
0
 /**
  * @param ChildGroup $myGroup The ChildGroup object to add.
  */
 protected function doAddMyGroup(ChildGroup $myGroup)
 {
     $this->collMyGroups[] = $myGroup;
     $myGroup->setOwner($this);
 }
 protected function validateOne()
 {
     setContentType("json");
     $group = new Group();
     $given = array_keys($_POST);
     $response["error"] = null;
     if (count($given) == 1) {
         if ($given[0] == "name") {
             $group->setName($_POST["name"]);
             $g = GroupQuery::create()->filterByOwner($this->data["loggedUser"])->filterByName($_POST["name"])->findOne();
             if ($g) {
                 $response["error"] = array("name" => "name", "message" => "You can not have two groups with the same name.");
                 $this->viewString(json_encode($response));
                 return;
             }
         } else {
             if ($given[0] == "description") {
                 $group->setDescription($_POST["description"]);
             } else {
                 setHTTPStatusCode("400");
                 return;
             }
         }
         if (!$group->validate()) {
             foreach ($group->getValidationFailures() as $failure) {
                 if ($given[0] == $failure->getPropertyPath()) {
                     $response["error"] = array("name" => $failure->getPropertyPath(), "message" => $failure->getMessage());
                 }
             }
         }
         $this->viewString(json_encode($response));
     } else {
         setHTTPStatusCode("400");
     }
 }
Example #9
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->aNote) {
         $this->aNote->removeShared($this);
     }
     if (null !== $this->aCategory) {
         $this->aCategory->removeShared($this);
     }
     if (null !== $this->aUser) {
         $this->aUser->removeShared($this);
     }
     if (null !== $this->aGroup) {
         $this->aGroup->removeShared($this);
     }
     $this->id = null;
     $this->what_id = null;
     $this->what_type = null;
     $this->to_id = null;
     $this->to_type = null;
     $this->rights = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }