/** * Filter the query by a related \Alchemy\Component\Cerberus\Model\RolePermission object * * @param \Alchemy\Component\Cerberus\Model\RolePermission|ObjectCollection $rolePermission the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildRoleQuery The current query, for fluid interface */ public function filterByRolePermission($rolePermission, $comparison = null) { if ($rolePermission instanceof \Alchemy\Component\Cerberus\Model\RolePermission) { return $this->addUsingAlias(RoleTableMap::COL_ID, $rolePermission->getRoleId(), $comparison); } elseif ($rolePermission instanceof ObjectCollection) { return $this->useRolePermissionQuery()->filterByPrimaryKeys($rolePermission->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByRolePermission() only accepts arguments of type \\Alchemy\\Component\\Cerberus\\Model\\RolePermission or Collection'); } }
/** * 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 \Alchemy\Component\Cerberus\Model\RolePermission $obj A \Alchemy\Component\Cerberus\Model\RolePermission 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->getRoleId(), (string) $obj->getPermissionId())); } // if key === null self::$instances[$key] = $obj; } }
/** * Remove role of this object * through the role_permission cross reference table. * * @param ChildRole $role * @return ChildPermission The current object (for fluent API support) */ public function removeRole(ChildRole $role) { if ($this->getRoles()->contains($role)) { $rolePermission = new ChildRolePermission(); $rolePermission->setRole($role); if ($role->isPermissionsLoaded()) { //remove the back reference if available $role->getPermissions()->removeObject($this); } $rolePermission->setPermission($this); $this->removeRolePermission(clone $rolePermission); $rolePermission->clear(); $this->collRoles->remove($this->collRoles->search($role)); if (null === $this->rolesScheduledForDeletion) { $this->rolesScheduledForDeletion = clone $this->collRoles; $this->rolesScheduledForDeletion->clear(); } $this->rolesScheduledForDeletion->push($role); } return $this; }
/** * Exclude object from result * * @param ChildRolePermission $rolePermission Object to remove from the list of results * * @return $this|ChildRolePermissionQuery The current query, for fluid interface */ public function prune($rolePermission = null) { if ($rolePermission) { $this->addCond('pruneCond0', $this->getAliasedColName(RolePermissionTableMap::COL_ROLE_ID), $rolePermission->getRoleId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(RolePermissionTableMap::COL_PERMISSION_ID), $rolePermission->getPermissionId(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } return $this; }