예제 #1
0
 /**
  * Declares an association between this object and a ChildRole object.
  *
  * @param  ChildRole $v
  * @return $this|\Alchemy\Component\Cerberus\Model\RolePermission The current object (for fluent API support)
  * @throws PropelException
  */
 public function setRole(ChildRole $v = null)
 {
     if ($v === null) {
         $this->setRoleId(NULL);
     } else {
         $this->setRoleId($v->getId());
     }
     $this->aRole = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildRole object, it will not be re-added.
     if ($v !== null) {
         $v->addRolePermission($this);
     }
     return $this;
 }
예제 #2
0
 /**
  * Exclude object from result
  *
  * @param   ChildRole $role Object to remove from the list of results
  *
  * @return $this|ChildRoleQuery The current query, for fluid interface
  */
 public function prune($role = null)
 {
     if ($role) {
         $this->addUsingAlias(RoleTableMap::COL_ID, $role->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
예제 #3
0
 /**
  * Filter the query by a related \Alchemy\Component\Cerberus\Model\Role object
  *
  * @param \Alchemy\Component\Cerberus\Model\Role|ObjectCollection $role The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildUserRoleQuery The current query, for fluid interface
  */
 public function filterByRole($role, $comparison = null)
 {
     if ($role instanceof \Alchemy\Component\Cerberus\Model\Role) {
         return $this->addUsingAlias(UserRoleTableMap::COL_ROLE_ID, $role->getId(), $comparison);
     } elseif ($role instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(UserRoleTableMap::COL_ROLE_ID, $role->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByRole() only accepts arguments of type \\Alchemy\\Component\\Cerberus\\Model\\Role or Collection');
     }
 }