• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfGuardUserPermissionPeer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中sfGuardUserPermissionPeer的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUserPermissionPeer类的具体用法?PHP sfGuardUserPermissionPeer怎么用?PHP sfGuardUserPermissionPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了sfGuardUserPermissionPeer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: savesfGuardUserPermissionList

 public function savesfGuardUserPermissionList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['sf_guard_user_permission_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(sfGuardUserPermissionPeer::PERMISSION_ID, $this->object->getPrimaryKey());
     sfGuardUserPermissionPeer::doDelete($c, $con);
     $values = $this->getValue('sf_guard_user_permission_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new sfGuardUserPermission();
             $obj->setPermissionId($this->object->getPrimaryKey());
             $obj->setUserId($value);
             $obj->save();
         }
     }
 }
开发者ID:voota,项目名称:voota,代码行数:25,代码来源:BasesfGuardPermissionForm.class.php


示例2: 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 = sfGuardUserPermissionPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setUserId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPermissionId($arr[$keys[1]]);
     }
 }
开发者ID:Chipusy,项目名称:lkbroker,代码行数:27,代码来源:BasesfGuardUserPermission.php


示例3: doOnDeleteCascade

 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = sfGuardUserPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related sfGuardUserPermission objects
         $c = new Criteria(sfGuardUserPermissionPeer::DATABASE_NAME);
         $c->add(sfGuardUserPermissionPeer::USER_ID, $obj->getId());
         $affectedRows += sfGuardUserPermissionPeer::doDelete($c, $con);
         // delete related sfGuardUserGroup objects
         $c = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME);
         $c->add(sfGuardUserGroupPeer::USER_ID, $obj->getId());
         $affectedRows += sfGuardUserGroupPeer::doDelete($c, $con);
         // delete related sfGuardRememberKey objects
         $c = new Criteria(sfGuardRememberKeyPeer::DATABASE_NAME);
         $c->add(sfGuardRememberKeyPeer::USER_ID, $obj->getId());
         $affectedRows += sfGuardRememberKeyPeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:35,代码来源:BasesfGuardUserPeer.php


示例4: getsfGuardUserPermissionsJoinsfGuardPermission

 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this sfGuardUser is new, it will return
  * an empty collection; or if this sfGuardUser has previously
  * been saved, it will retrieve related sfGuardUserPermissions from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in sfGuardUser.
  */
 public function getsfGuardUserPermissionsJoinsfGuardPermission($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(sfGuardUserPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collsfGuardUserPermissions === null) {
         if ($this->isNew()) {
             $this->collsfGuardUserPermissions = array();
         } else {
             $criteria->add(sfGuardUserPermissionPeer::USER_ID, $this->id);
             $this->collsfGuardUserPermissions = sfGuardUserPermissionPeer::doSelectJoinsfGuardPermission($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(sfGuardUserPermissionPeer::USER_ID, $this->id);
         if (!isset($this->lastsfGuardUserPermissionCriteria) || !$this->lastsfGuardUserPermissionCriteria->equals($criteria)) {
             $this->collsfGuardUserPermissions = sfGuardUserPermissionPeer::doSelectJoinsfGuardPermission($criteria, $con, $join_behavior);
         }
     }
     $this->lastsfGuardUserPermissionCriteria = $criteria;
     return $this->collsfGuardUserPermissions;
 }
开发者ID:voota,项目名称:voota,代码行数:37,代码来源:BasesfGuardUser.php


示例5: getPermissions

 public function getPermissions()
 {
     if (!$this->permissions) {
         $this->permissions = array();
         $c = new Criteria();
         $c->add(sfGuardUserPermissionPeer::USER_ID, $this->getId());
         $ups = sfGuardUserPermissionPeer::doSelectJoinsfGuardPermission($c);
         foreach ($ups as $up) {
             $permission = $up->getsfGuardPermission();
             $this->permissions[$permission->getName()] = $permission;
         }
     }
     return $this->permissions;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:14,代码来源:PluginsfGuardUser.php


示例6: retrieveByPK

 /**
  * Retrieve object using using composite pkey values.
  * @param      int $user_id
  * @param      int $permission_id
  * @param      PropelPDO $con
  * @return     sfGuardUserPermission
  */
 public static function retrieveByPK($user_id, $permission_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $user_id, (string) $permission_id));
     if (null !== ($obj = sfGuardUserPermissionPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(sfGuardUserPermissionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(sfGuardUserPermissionPeer::DATABASE_NAME);
     $criteria->add(sfGuardUserPermissionPeer::USER_ID, $user_id);
     $criteria->add(sfGuardUserPermissionPeer::PERMISSION_ID, $permission_id);
     $v = sfGuardUserPermissionPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
开发者ID:BGCX261,项目名称:zrobtotak-svn-to-git,代码行数:22,代码来源:BasesfGuardUserPermissionPeer.php


示例7: executePermissions

 public function executePermissions(sfWebRequest $request)
 {
     $module = 'sfGuardUser';
     if (!in_array($module, array_keys(sfPlop::getSafePluginModules()))) {
         $this->redirect('@sf_plop_dashboard');
     }
     if ($request->isMethod(sfRequest::POST)) {
         if ($request->isXmlHttpRequest()) {
             $this->setTemplate('ajaxPermissions');
             $this->setLayout(false);
         }
         $group_id = $request->getParameter('g');
         $user_id = $request->getParameter('u');
         $permission_id = $request->getParameter('p');
         if ($group_id) {
             $group_exists = sfPlopGuard::groupExists($group_id);
             if (!$group_exists && $request->isXmlHttpRequest()) {
                 return sfView::ERROR;
             } else {
                 if (!$group_exists) {
                     $this->redirect('@sf_plop_dashboard_permissions');
                 }
             }
         }
         if ($user_id) {
             $user_exists = sfPlopGuard::userExists($user_id);
             if (!$user_exists && $request->isXmlHttpRequest()) {
                 return sfView::ERROR;
             } else {
                 if (!$user_exists) {
                     $this->redirect('@sf_plop_dashboard_permissions');
                 }
             }
         }
         if (isset($group_exists) && isset($user_exists)) {
             $user_group = sfGuardUserGroupPeer::retrieveByPK($user_id, $group_id);
             if ($user_group) {
                 $user_group->delete();
             } else {
                 $user_group = new sfGuardUsergroup();
                 $user_group->setUserId($user_id);
                 $user_group->setGroupId($group_id);
                 $user_group->save();
                 $this->getResponse()->setStatusCode(201);
             }
         }
         if ($permission_id) {
             if ($permission_id == 'super') {
                 if (!sfPlopGuard::isLastSuperAdminUser($user_id)) {
                     $user = sfGuardUserPeer::retrieveByPK($user_id);
                     if ($user->getIsSuperAdmin()) {
                         $user->setIsSuperAdmin(false);
                     } else {
                         $user->setIsSuperAdmin(true);
                     }
                     $user->save();
                 } else {
                     $this->getResponse()->setStatusCode(202);
                     return sfView::ERROR;
                 }
             } else {
                 if (!is_int($permission_id)) {
                     $permission_exists = sfPlopGuard::permissionExists($permission_id);
                     if (!$permission_exists) {
                         $modules = sfPlop::getSafePluginModules();
                         if ($request->isXmlHttpRequest() && !isset($modules[$permission_id])) {
                             return sfView::ERROR;
                         } elseif (!isset($modules[$permission_id])) {
                             $this->redirect('@sf_plop_dashboard_permissions');
                         } else {
                             $module = $modules[$permission_id];
                         }
                         $permission = new sfGuardPermission();
                         $permission->setName($permission_id);
                         $permission->setDescription($module['name']);
                         $permission->save();
                         $permission_id = $permission->getId();
                         $this->getResponse()->setStatusCode(201);
                     } else {
                         $permission_id = sfPlopGuard::getPermission($permission_id)->getId();
                     }
                 } else {
                     $permission_exists = sfPlopGuard::permissionExists($permission_id);
                     if (!$permission_exists && $request->isXmlHttpRequest()) {
                         return sfView::ERROR;
                     } else {
                         if (!$permission_exists) {
                             $this->redirect('@sf_plop_dashboard_permissions');
                         }
                     }
                 }
                 if (isset($user_exists)) {
                     $user_permission = sfGuardUserPermissionPeer::retrieveByPK($user_id, $permission_id);
                     if ($user_permission) {
                         $user_permission->delete();
                     } else {
                         $user_permission = new sfGuardUserPermission();
                         $user_permission->setUserId($user_id);
                         $user_permission->setPermissionId($permission_id);
                         $user_permission->save();
//.........这里部分代码省略.........
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:101,代码来源:BasesfPlopDashboardActions.class.php


示例8: getsfGuardUserPermissionsJoinsfGuardPermission

 public function getsfGuardUserPermissionsJoinsfGuardPermission($criteria = null, $con = null)
 {
     include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardUserPermissionPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collsfGuardUserPermissions === null) {
         if ($this->isNew()) {
             $this->collsfGuardUserPermissions = array();
         } else {
             $criteria->add(sfGuardUserPermissionPeer::USER_ID, $this->getId());
             $this->collsfGuardUserPermissions = sfGuardUserPermissionPeer::doSelectJoinsfGuardPermission($criteria, $con);
         }
     } else {
         $criteria->add(sfGuardUserPermissionPeer::USER_ID, $this->getId());
         if (!isset($this->lastsfGuardUserPermissionCriteria) || !$this->lastsfGuardUserPermissionCriteria->equals($criteria)) {
             $this->collsfGuardUserPermissions = sfGuardUserPermissionPeer::doSelectJoinsfGuardPermission($criteria, $con);
         }
     }
     $this->lastsfGuardUserPermissionCriteria = $criteria;
     return $this->collsfGuardUserPermissions;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:24,代码来源:BasesfGuardUser.php


示例9: 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    sfGuardUserPermission A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `USER_ID`, `PERMISSION_ID` FROM `sf_guard_user_permission` WHERE `USER_ID` = :p0 AND `PERMISSION_ID` = :p1';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
         $stmt->bindValue(':p1', $key[1], 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 sfGuardUserPermission();
         $obj->hydrate($row);
         sfGuardUserPermissionPeer::addInstanceToPool($obj, serialize(array((string) $row[0], (string) $row[1])));
     }
     $stmt->closeCursor();
     return $obj;
 }
开发者ID:ratibus,项目名称:Crew,代码行数:30,代码来源:BasesfGuardUserPermissionQuery.php


示例10: doOnDeleteCascade

 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = sfGuardUserPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related NotaPedido objects
         $c = new Criteria(NotaPedidoPeer::DATABASE_NAME);
         $c->add(NotaPedidoPeer::ADMINISTRA_ID, $obj->getId());
         $affectedRows += NotaPedidoPeer::doDelete($c, $con);
         // delete related NotaPedido objects
         $c = new Criteria(NotaPedidoPeer::DATABASE_NAME);
         $c->add(NotaPedidoPeer::SOLICITA_ID, $obj->getId());
         $affectedRows += NotaPedidoPeer::doDelete($c, $con);
         // delete related NotaPedido objects
         $c = new Criteria(NotaPedidoPeer::DATABASE_NAME);
         $c->add(NotaPedidoPeer::CONTROLA_ID, $obj->getId());
         $affectedRows += NotaPedidoPeer::doDelete($c, $con);
         // delete related NotaPedido objects
         $c = new Criteria(NotaPedidoPeer::DATABASE_NAME);
         $c->add(NotaPedidoPeer::AUTORIZA_ID, $obj->getId());
         $affectedRows += NotaPedidoPeer::doDelete($c, $con);
         // delete related NotaPedidoEstado objects
         $c = new Criteria(NotaPedidoEstadoPeer::DATABASE_NAME);
         $c->add(NotaPedidoEstadoPeer::USER_ID, $obj->getId());
         $affectedRows += NotaPedidoEstadoPeer::doDelete($c, $con);
         // delete related Evento objects
         $c = new Criteria(EventoPeer::DATABASE_NAME);
         $c->add(EventoPeer::USER_ID, $obj->getId());
         $affectedRows += EventoPeer::doDelete($c, $con);
         // delete related CompraEstado objects
         $c = new Criteria(CompraEstadoPeer::DATABASE_NAME);
         $c->add(CompraEstadoPeer::USER_ID, $obj->getId());
         $affectedRows += CompraEstadoPeer::doDelete($c, $con);
         // delete related Venta objects
         $c = new Criteria(VentaPeer::DATABASE_NAME);
         $c->add(VentaPeer::TRANSPORTISTA_INTERNO_ID, $obj->getId());
         $affectedRows += VentaPeer::doDelete($c, $con);
         // delete related VentaEstado objects
         $c = new Criteria(VentaEstadoPeer::DATABASE_NAME);
         $c->add(VentaEstadoPeer::USER_ID, $obj->getId());
         $affectedRows += VentaEstadoPeer::doDelete($c, $con);
         // delete related sfGuardUserPermission objects
         $c = new Criteria(sfGuardUserPermissionPeer::DATABASE_NAME);
         $c->add(sfGuardUserPermissionPeer::USER_ID, $obj->getId());
         $affectedRows += sfGuardUserPermissionPeer::doDelete($c, $con);
         // delete related sfGuardUserGroup objects
         $c = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME);
         $c->add(sfGuardUserGroupPeer::USER_ID, $obj->getId());
         $affectedRows += sfGuardUserGroupPeer::doDelete($c, $con);
         // delete related sfGuardRememberKey objects
         $c = new Criteria(sfGuardRememberKeyPeer::DATABASE_NAME);
         $c->add(sfGuardRememberKeyPeer::USER_ID, $obj->getId());
         $affectedRows += sfGuardRememberKeyPeer::doDelete($c, $con);
         // delete related RecepcionPedido objects
         $c = new Criteria(RecepcionPedidoPeer::DATABASE_NAME);
         $c->add(RecepcionPedidoPeer::RECIBE_ID, $obj->getId());
         $affectedRows += RecepcionPedidoPeer::doDelete($c, $con);
         // delete related RecepcionPedido objects
         $c = new Criteria(RecepcionPedidoPeer::DATABASE_NAME);
         $c->add(RecepcionPedidoPeer::CONTROLA_ID, $obj->getId());
         $affectedRows += RecepcionPedidoPeer::doDelete($c, $con);
         // delete related RecepcionPedido objects
         $c = new Criteria(RecepcionPedidoPeer::DATABASE_NAME);
         $c->add(RecepcionPedidoPeer::ADMINISTRA_ID, $obj->getId());
         $affectedRows += RecepcionPedidoPeer::doDelete($c, $con);
         // delete related UserProfile objects
         $c = new Criteria(UserProfilePeer::DATABASE_NAME);
         $c->add(UserProfilePeer::USER_ID, $obj->getId());
         $affectedRows += UserProfilePeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
开发者ID:retrofox,项目名称:PCC,代码行数:87,代码来源:BasesfGuardUserPeer.php


示例11: findPk

 /**
  * Find object by primary key
  * <code>
  * $obj = $c->findPk(array(12, 34), $con);
  * </code>
  * @param     array[$user_id, $permission_id] $key Primary key to use for the query
  * @param     PropelPDO $con an optional connection object
  *
  * @return    sfGuardUserPermission|array|mixed the result, formatted by the current formatter
  */
 public function findPk($key, $con = null)
 {
     if (null !== ($obj = sfGuardUserPermissionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1])))) && $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,代码行数:22,代码来源:BasesfGuardUserPermissionQuery.php


示例12: retrieveByPK

 public static function retrieveByPK($user_id, $permission_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(sfGuardUserPermissionPeer::USER_ID, $user_id);
     $criteria->add(sfGuardUserPermissionPeer::PERMISSION_ID, $permission_id);
     $v = sfGuardUserPermissionPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:11,代码来源:BasesfGuardUserPermissionPeer.php



注:本文中的sfGuardUserPermissionPeer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfI18N类代码示例发布时间:2022-05-23
下一篇:
PHP sfGuardUserPeer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap