/** * {@inheritDoc} */ public function updateGroup(GroupInterface $group) { if (!$group instanceof \Persistent) { throw new \InvalidArgumentException('This group instance is not supported by the Propel GroupManager implementation'); } $group->save(); }
/** * @param string string $username * @param string GroupInterface $group * * @return array */ public function findByIncludedUsernameWithoutGroup($username, GroupInterface $group) { $qb = $this->createQueryBuilder(); $qb->field('groups.$id')->notEqual(new \MongoId($group->getId())); $qb->field('username')->equals(new \MongoRegex('/.*' . $username . '.*/i')); return $qb->getQuery()->execute(); }
/** * get Array with Principal-Data from User-Object. * * @param UserInterface|GroupInterface $principalObject * @param bool $show_id * * @return array * * @throws Exception */ private function getPrincipalArray($principalObject, $show_id = false) { if (!$principalObject instanceof UserInterface && !$principalObject instanceof GroupInterface) { throw new Exception('$principalObject must be of type UserInterface of GroupInterface'); } $principal = array(); if ($show_id) { $principal['id'] = $principalObject->getId(); } if ($principalObject instanceof UserInterface) { $principal['uri'] = 'principals/' . $principalObject->getUsername(); } else { $principal['uri'] = 'principals/' . $principalObject->getName(); } // get all fields from $this->fieldMap, additional to 'uri' and 'id' foreach ($this->fieldMap as $key => $value) { if (!method_exists($principalObject, $value['getter'])) { continue; } $valueGetter = call_user_func(array($principalObject, $value['getter'])); if ($valueGetter) { $principal[$key] = $valueGetter; } } return $principal; }
public function addGroup(GroupInterface $group) { if (!in_array($group->getRoles(), $this->getRoles())) { $this->addRole($group->getRoles()); } if (!$this->getGroups()->contains($group)) { $this->getGroups()->add($group); } return $this; }
/** * @param GroupInterface $group * @return string */ public static function getGroupAlias(GroupInterface $group) { return 'sf_group_' . $group->getId(); }
/** * @param string $message * @param GroupInterface $group */ protected function sendLog($message, GroupInterface $group) { $this->logger->info($message, array('group_name' => $group->getName())); }