本文整理汇总了PHP中sfGuardPermissionPeer类的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardPermissionPeer类的具体用法?PHP sfGuardPermissionPeer怎么用?PHP sfGuardPermissionPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfGuardPermissionPeer类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getsfGuardPermission
/**
* Get the associated sfGuardPermission object
*
* @param PropelPDO Optional Connection object.
* @return sfGuardPermission The associated sfGuardPermission object.
* @throws PropelException
*/
public function getsfGuardPermission(PropelPDO $con = null)
{
if ($this->asfGuardPermission === null && $this->permission_id !== null) {
$this->asfGuardPermission = sfGuardPermissionPeer::retrieveByPk($this->permission_id);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->asfGuardPermission->addsfGuardUserPermissions($this);
*/
}
return $this->asfGuardPermission;
}
开发者ID:Chipusy,项目名称:lkbroker,代码行数:21,代码来源:BasesfGuardUserPermission.php
示例2: addPermissionByName
public function addPermissionByName($name, $con = null)
{
$permission = sfGuardPermissionPeer::retrieveByName($name);
if (!$permission) {
throw new Exception(sprintf('The permission "%s" does not exist.', $name));
}
$up = new sfGuardUserPermission();
$up->setsfGuardUser($this);
$up->setPermissionId($permission->getId());
$up->save($con);
}
开发者ID:sgrove,项目名称:cothinker,代码行数:11,代码来源:PluginsfGuardUser.php
示例3: retrieveByPKs
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(sfGuardPermissionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(sfGuardPermissionPeer::DATABASE_NAME);
$criteria->add(sfGuardPermissionPeer::ID, $pks, Criteria::IN);
$objs = sfGuardPermissionPeer::doSelect($criteria, $con);
}
return $objs;
}
开发者ID:pascaldevink,项目名称:twneed,代码行数:23,代码来源:BasesfGuardPermissionPeer.php
示例4: getsfGuardPermission
public function getsfGuardPermission($con = null)
{
if ($this->asfGuardPermission === null && $this->permission_id !== null) {
include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardPermissionPeer.php';
$this->asfGuardPermission = sfGuardPermissionPeer::retrieveByPK($this->permission_id, $con);
}
return $this->asfGuardPermission;
}
开发者ID:net7,项目名称:Talia-CMS,代码行数:8,代码来源:BasesfGuardUserPermission.php
示例5: getsfGuardPermission
/**
* Get the associated sfGuardPermission object
*
* @param PropelPDO Optional Connection object.
* @return sfGuardPermission The associated sfGuardPermission object.
* @throws PropelException
*/
public function getsfGuardPermission(PropelPDO $con = null)
{
if ($this->asfGuardPermission === null && $this->permission_id !== null) {
$c = new Criteria(sfGuardPermissionPeer::DATABASE_NAME);
$c->add(sfGuardPermissionPeer::ID, $this->permission_id);
$this->asfGuardPermission = sfGuardPermissionPeer::doSelectOne($c, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->asfGuardPermission->addsfGuardGroupPermissions($this);
*/
}
return $this->asfGuardPermission;
}
开发者ID:retrofox,项目名称:PCC,代码行数:23,代码来源:BasesfGuardGroupPermission.php
示例6: doSelectJoinAllExceptsfGuardUser
/**
* Selects a collection of sfGuardUserPermission objects pre-filled with all related objects except sfGuardUser.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of sfGuardUserPermission objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAllExceptsfGuardUser(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
sfGuardUserPermissionPeer::addSelectColumns($criteria);
$startcol2 = sfGuardUserPermissionPeer::NUM_COLUMNS - sfGuardUserPermissionPeer::NUM_LAZY_LOAD_COLUMNS;
sfGuardPermissionPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (sfGuardPermissionPeer::NUM_COLUMNS - sfGuardPermissionPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(sfGuardUserPermissionPeer::PERMISSION_ID, sfGuardPermissionPeer::ID, $join_behavior);
// symfony_behaviors behavior
foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
call_user_func($sf_hook, 'BasesfGuardUserPermissionPeer', $criteria, $con);
}
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = sfGuardUserPermissionPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = sfGuardUserPermissionPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://propel.phpdb.org/trac/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = sfGuardUserPermissionPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
sfGuardUserPermissionPeer::addInstanceToPool($obj1, $key1);
}
// if obj1 already loaded
// Add objects for joined sfGuardPermission rows
$key2 = sfGuardPermissionPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = sfGuardPermissionPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = sfGuardPermissionPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
sfGuardPermissionPeer::addInstanceToPool($obj2, $key2);
}
// if $obj2 already loaded
// Add the $obj1 (sfGuardUserPermission) to the collection in $obj2 (sfGuardPermission)
$obj2->addsfGuardUserPermission($obj1);
}
// if joined row is not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
开发者ID:BGCX261,项目名称:zrobtotak-svn-to-git,代码行数:63,代码来源:BasesfGuardUserPermissionPeer.php
示例7: executeEditWin
public function executeEditWin(sfWebRequest $request)
{
$this->sf_guard_permission = sfGuardPermissionPeer::retrieveByPK($request->getParameter('id'));
$this->form = $this->configuration->getForm($this->sf_guard_permission);
//die ('$request->getParameter(id): '.$request->getParameter('id'));
}
开发者ID:retrofox,项目名称:PCC,代码行数:6,代码来源:actions.class.php
示例8: getPermission
/**
* Get a permission given to an id or a name.
* @param Mixed $permission
* @return Boolean
*/
public static function getPermission($permission)
{
$return = sfGuardPermissionPeer::retrieveByPK($permission);
if (!$return) {
$return = sfGuardPermissionPeer::retrieveByName($permission);
}
return $return;
}
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:13,代码来源:sfPlopGuard.class.php
示例9: fromArray
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* The default key type is the column's phpname (e.g. 'AuthorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = sfGuardPermissionPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setName($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setDescription($arr[$keys[2]]);
}
}
开发者ID:rewrewby,项目名称:propertyx,代码行数:30,代码来源:BasesfGuardPermission.php
示例10: findPkSimple
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return sfGuardPermission A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `NAME`, `DESCRIPTION` FROM `sf_guard_permission` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new sfGuardPermission();
$obj->hydrate($row);
sfGuardPermissionPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
开发者ID:eddypre,项目名称:Quirofano,代码行数:30,代码来源:BasesfGuardPermissionQuery.php
示例11: grantProjectGroupPermission
public function grantProjectGroupPermission($group_name, $permission_name)
{
$permission = sfGuardPermissionPeer::retrieveByName($this->getUuid() . '-' . $permission_name);
$group = sfGuardGroupPeer::retrieveByName($this->getUuid() . '-' . $group_name);
if ($permission == null) {
sfContext::getInstance()->getLogger()->info('permission not found: [' . $this->getUuid() . $permission_name . ']');
return false;
} elseif ($group == null) {
sfContext::getInstance()->getLogger()->info('group not found: [' . $this->getUuid() . $group_name . ']');
return false;
}
// TODO: make sure that the group permission name does not already exist
$groupPermission = new sfGuardGroupPermission();
$groupPermission->setGroupId($group->getPrimaryKey());
$groupPermission->setPermissionId($permission->getId());
$groupPermission->save();
sfContext::getInstance()->getLogger()->info('group permission saved: [' . $this->getUuid() . $group_name . ']:[' . $this->getUuid() . $permission_name . ']');
}
开发者ID:sgrove,项目名称:cothinker,代码行数:18,代码来源:Project.php
示例12: doSelectJoinAllExceptsfGuardGroup
public static function doSelectJoinAllExceptsfGuardGroup(Criteria $c, $con = null)
{
$c = clone $c;
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
sfGuardGroupPermissionPeer::addSelectColumns($c);
$startcol2 = sfGuardGroupPermissionPeer::NUM_COLUMNS - sfGuardGroupPermissionPeer::NUM_LAZY_LOAD_COLUMNS + 1;
sfGuardPermissionPeer::addSelectColumns($c);
$startcol3 = $startcol2 + sfGuardPermissionPeer::NUM_COLUMNS;
$c->addJoin(sfGuardGroupPermissionPeer::PERMISSION_ID, sfGuardPermissionPeer::ID);
$rs = BasePeer::doSelect($c, $con);
$results = array();
while ($rs->next()) {
$omClass = sfGuardGroupPermissionPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
$omClass = sfGuardPermissionPeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol2);
$newObject = true;
for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
$temp_obj2 = $temp_obj1->getsfGuardPermission();
if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addsfGuardGroupPermission($obj1);
break;
}
}
if ($newObject) {
$obj2->initsfGuardGroupPermissions();
$obj2->addsfGuardGroupPermission($obj1);
}
$results[] = $obj1;
}
return $results;
}
开发者ID:soon0009,项目名称:EMS,代码行数:40,代码来源:BasesfGuardGroupPermissionPeer.php
示例13: addSortCriteria
protected function addSortCriteria($criteria)
{
if ($this->getRequestParameter('sort') == '') {
return;
}
$column = sfGuardPermissionPeer::translateFieldName(sfInflector::camelize($this->getRequestParameter('sort')), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME);
if ('asc' == strtolower($this->getRequestParameter('dir'))) {
$criteria->addAscendingOrderByColumn($column);
} else {
$criteria->addDescendingOrderByColumn($column);
}
}
开发者ID:ketheriel,项目名称:ETVA,代码行数:12,代码来源:actions.class.php
示例14: configure
public function configure()
{
unset($this['sf_guard_user_group_list']);
$this->setWidget('sf_guard_group_permission_list', new sfWidgetFormSelectDoubleList(array('choices' => sfGuardPermissionPeer::getChoices(), 'label_unassociated' => 'No seleccionados', 'label_associated' => 'Seleccionados', 'associate' => '<img src="../../../sfFormExtraPlugin/images/next.png" alt="Seleccionar" />', 'unassociate' => '<img src="../../../sfFormExtraPlugin/images/previous.png" alt="Deseleccionar" />')));
$this->widgetSchema['sf_guard_group_permission_list']->setLabel('Permissions');
}
开发者ID:nvidela,项目名称:kimkelen,代码行数:6,代码来源:sfGuardGroupForm.class.php
示例15: findPk
/**
* Find object by primary key
* Use instance pooling to avoid a database query if the object exists
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return sfGuardPermission|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if (null !== ($obj = sfGuardPermissionPeer::getInstanceFromPool((string) $key)) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
return $obj;
} else {
// the object has not been requested yet, or the formatter is not an object formatter
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria->filterByPrimaryKey($key)->getSelectStatement($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
开发者ID:EQ4,项目名称:smint,代码行数:23,代码来源:BasesfGuardPermissionQuery.php
示例16: executeChangeRole
public function executeChangeRole($request)
{
$this->form = new ChangeRoleForm(array(), array('actual_user' => $this->getUser()));
$values = $request->getParameter($this->form->getName());
if (isset($values['roles']) && !empty($values['roles'])) {
$this->getUser()->clearCredentials();
$new_login_role = sfGuardGroupPeer::retrieveByPK($values['roles']);
$this->getUser()->setLoginRole($new_login_role->getName());
//die(var_dump($this->getUser()->getAttribute('login_role')));
$this->getUser()->addCredentials(sfGuardPermissionPeer::retrieveAllCredentialsForARole(sfGuardGroupPeer::retrieveByName($this->getUser()->getLoginRole())));
}
return $this->redirect("mainBackend/index");
}
开发者ID:nvidela,项目名称:kimkelen,代码行数:13,代码来源:actions.class.php
注:本文中的sfGuardPermissionPeer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论