本文整理汇总了PHP中sfGuardGroupPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardGroupPeer::retrieveByPK方法的具体用法?PHP sfGuardGroupPeer::retrieveByPK怎么用?PHP sfGuardGroupPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardGroupPeer
的用法示例。
在下文中一共展示了sfGuardGroupPeer::retrieveByPK方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeJsonUpdate
public function executeJsonUpdate(sfWebRequest $request)
{
$isAjax = $request->isXmlHttpRequest();
if (!$isAjax) {
return $this->redirect('@homepage');
}
$id = $request->getParameter('id');
$group = sfGuardGroupPeer::retrieveByPK($id);
if (!$group) {
$group_form = new sfGuardGroupForm();
} else {
$group_form = new sfGuardGroupForm($group);
}
$result = $this->processForm($request, $group_form);
try {
// remove existing permissions for the given group
$c = new Criteria();
$c->add(EtvaPermissionGroupPeer::GROUP_ID, $request->getParameter('id'), Criteria::EQUAL);
$g_p = EtvaPermissionGroupPeer::doSelect($c);
//filter group permissions
foreach ($g_p as $p) {
$p->delete();
}
// add new permission set
$perm_list = $request->getParameter('sf_guard_group_permission_list');
$perm_list_dec = json_decode($perm_list);
foreach ($perm_list_dec as $object) {
$g_p = new EtvaPermissionGroup();
$g_p->setGroupId($request->getParameter('id'));
$g_p->setEtvapermId($object);
$g_p->save();
}
} catch (Exception $e) {
$result = array('success' => false, 'error' => 'Could not perform operation', 'agent' => sfConfig::get('config_acronym'), 'info' => 'Could not perform operation');
}
if (!$result['success']) {
$error = $this->setJsonError($result);
return $this->renderText($error);
}
$msg_i18n = $this->getContext()->getI18N()->__('Group saved successfully');
$response = array('success' => true, 'agent' => 'Central Management', 'response' => $msg_i18n, 'group_id' => $result['object']['Id']);
$return = json_encode($response);
$this->getResponse()->setHttpHeader('Content-type', 'application/json');
return $this->renderText($return);
}
示例2: getsfGuardGroup
public function getsfGuardGroup($con = null)
{
if ($this->asfGuardGroup === null && $this->group_id !== null) {
include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardGroupPeer.php';
$this->asfGuardGroup = sfGuardGroupPeer::retrieveByPK($this->group_id, $con);
}
return $this->asfGuardGroup;
}
示例3: executeEditWin
public function executeEditWin(sfWebRequest $request)
{
$this->sf_guard_group = sfGuardGroupPeer::retrieveByPK($request->getParameter('id'));
$this->form = $this->configuration->getForm($this->sf_guard_group);
//die ('$request->getParameter(id): '.$request->getParameter('id'));
}
示例4: groupExists
/**
* Check if a group exists given to an id.
* @param Int $group_id
* @return Boolean
*/
public static function groupExists($id)
{
return sfGuardGroupPeer::retrieveByPK($id) ? true : false;
}
示例5: 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");
}