本文整理汇总了PHP中Group::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::getId方法的具体用法?PHP Group::getId怎么用?PHP Group::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testManyToManyPersist
public function testManyToManyPersist()
{
$this->group->addUser($this->user);
$this->entityManager->persist($this->user);
$this->entityManager->persist($this->group);
$this->entityManager->flush();
$persistedGroup = $this->groupRepository->find($this->group->getId());
$persistedUser = $this->userRepository->find($this->user->getId());
$this->assertEquals($this->user, $persistedGroup->getUser()->first());
$this->assertEquals($this->group, $persistedUser->getGroup()->first());
}
示例2: serialize
/**
* {@inheritDoc}
*/
public function serialize()
{
$players = $teams = array();
foreach ($this->members as $member) {
if ($member instanceof \Player) {
$players[] = $member;
} else {
$teams[] = $member;
}
}
return serialize(array('group' => $this->group->getId(), 'players' => \Player::mapToIDs($players), 'teams' => \Team::mapToIDs($teams)));
}
示例3: testDelete
/**
* @todo Implement testDelete().
*/
public function testDelete()
{
$this->object->setName('testgroup');
$this->object->save();
$this->object->delete();
$this->assertEquals(new Group(), new Group($this->object->getId()));
}
示例4: save
public function save()
{
$Group = new Group($this->data->Group);
$Group->save();
$go = '>auth/Group/formObject/' . $Group->getId();
$this->renderPrompt('information', 'OK', $go);
}
示例5: User
function testCreate_ManyToMany()
{
$this->_createModelAndIncludeThem('user', 'User');
$this->_createModelAndIncludeThem('group', 'Group');
$user = new User();
$user->setFirstName($user_first_name = 'Vasya');
$user->save();
$group = new Group();
$group->setTitle($group_title = 'Moderasti');
$group->getUsers()->add($user);
$group->save();
$loaded_user = lmbActiveRecord::findById('User', $user->getId());
$this->assertEqual($loaded_user->getFirstName(), $user_first_name);
$this->assertEqual($loaded_user->getGroups()->at(0)->getId(), $group->getId());
$loaded_group = lmbActiveRecord::findById('Group', $group->getId());
$this->assertEqual($loaded_group->getUsers()->at(0)->getId(), $user->getId());
}
示例6: __construct
public function __construct()
{
parent::__construct('formGroupEdit', 'Edit Group');
$id = Sanitizer::getInstance()->filterUint('id');
$group = new Group($id);
$this->addElement(new ElementHidden('id', null, $group->getId()));
$this->addElement(new ElementInput('title', 'Title', $group->getTitle()));
$this->addElement(new ElementInput('css', 'CSS', $group->getAttribute('css'), 'Additional styles to be applied to this group title (eg: color: red) '));
$this->getElement('css')->setMinMaxLengths(0, 128);
$this->addDefaultButtons();
}
示例7: _
<?php
// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* Group add page
* @author Abhik Chakraborty
*/
$do_group = new Group();
$idgroup = $do_group->getId($sqcrm_record_id);
?>
<div class="container-fluid">
<div class="row-fluid">
<?php
include_once "modules/Settings/settings_leftmenu.php";
?>
<div class="span9" style="margin-left:3px;">
<div class="box_content">
<h3><?php
echo _('Settings');
?>
> <a href="<?php
echo NavigationControl::getNavigationLink($module, "group_list");
?>
"><?php
echo _('Group');
?>
</a></h3>
<p><?php
echo _('Manage group and users related to the group');
?>
</p>
示例8: lookup
function lookup($id)
{
return $id && is_numeric($id) && ($g = new Group($id)) && $g->getId() == $id ? $g : null;
}
示例9: addGroup
/**
* @param \Wonderland\Application\Model\Group $group
* @return \Wonderland\Application\Model\Member
*/
public function addGroup(Group $group)
{
$this->groups[$group->getId()] = $group;
return $this;
}
示例10: transform
/**
* Transforms an object into an elastica object
*
* @param \Group $group the object to convert
* @param array $fields the keys we want to have in the returned array
*
* @return Document
**/
public function transform($group, array $fields = array())
{
return new Document($group->getId(), array('members' => $group->getPlayerIDs()));
}
示例11: setGroup
/**
* Declares an association between this object and a Group object.
*
* @param Group $v
* @return DirectoryPermission The current object (for fluent API support)
* @throws PropelException
*/
public function setGroup(Group $v = null)
{
if ($v === null) {
$this->setGroupId(NULL);
} else {
$this->setGroupId($v->getId());
}
$this->aGroup = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Group object, it will not be re-added.
if ($v !== null) {
$v->addDirectoryPermission($this);
}
return $this;
}
示例12: addGroup
/**
* Ajoute un groupe dont la fondation seras proprio
* @return int $id_group
* @param String $name_group
* @param bool $alone[optional]
* @param bool $public[optional]
*/
public function addGroup($name_group, $open = 0, $public = 0)
{
$Group = new Group(0, $this->Fundation, html_entity_decode($name_group), $open, $public);
return $Group->getId();
}
示例13: redirect
$groupId = $sanitizer->filterUint('group');
$sql = 'DELETE FROM privileges_g WHERE permission = :priv AND `group` = :groupId ';
$stmt = $db->prepare($sql);
$stmt->bindValue(':priv', $priv);
$stmt->bindValue(':groupId', $groupId);
$stmt->execute();
redirect('group.php?action=view&id=' . $groupId, 'Permision revoked');
break;
case 'kick':
Session::requirePriv('GROUP_KICK');
$group = new Group($sanitizer->filterUint('group'));
$user = User::getUserById($sanitizer->filterUint('user'));
$sql = 'DELETE FROM group_memberships WHERE user = :userId AND `group` = :groupId LIMIT 1';
$stmt = $db->prepare($sql);
$stmt->bindValue(':userId', $user->getId());
$stmt->bindValue(':groupId', $group->getId());
$stmt->execute();
redirect('group.php?action=view&id=' . $group->getId(), 'User kicked from group.');
break;
case 'edit':
$id = $sanitizer->filterUint('id');
$group = new Group($id);
$f = new FormGroupEdit();
$f->addElement(new ElementHidden('action', null, 'edit'));
if ($f->validate()) {
$f->process();
}
require_once 'includes/widgets/header.php';
$tpl->assignForm($f);
$tpl->display('form.tpl');
break;
示例14: addInstanceToPool
/**
* 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 -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Group $value A Group object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Group $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例15: eventChangeAssignedToEntity
/**
* event function to change the assigned to for entity for a module
* The method will check the assigned to value, if its group or user
* and then accordingly will change the assigned to
* @param object $evctl
*/
function eventChangeAssignedToEntity(EventControler $evctl)
{
$next_page = $evctl->next_page;
$record_ids = $evctl->ids;
$group_transfer_opt = false;
$transfer_to_user = false;
$transfer_to_group = false;
$module_name = $evctl->module;
$module_id = $evctl->module_id;
if ($evctl->group_transfer_opt == 'yes') {
$group_transfer_opt = true;
}
if ($group_transfer_opt === true) {
if ($evctl->assigned_to_selector == 'user') {
$transfer_to_user = true;
} elseif ($evctl->assigned_to_selector == 'group') {
$transfer_to_group = true;
}
} else {
$transfer_to_user = true;
}
if (($transfer_to_user === true || $transfer_to_group === true) && sizeof($record_ids) > 0) {
$do_data_history = new DataHistory();
$do_feed_queue = new LiveFeedQueue();
$module = new $module_name();
if ($transfer_to_user === true) {
$do_user = new User();
$do_user->getId((int) $evctl->user_selector);
$new_assigned_to = $do_user->user_name;
foreach ($record_ids as $id) {
$feed_other_assigne = array();
$module->getId($id);
$old_assigned_to = $module->assigned_to;
if ($module->idgroup > 0) {
$feed_other_assigne = array("related" => "group", "data" => array("key" => "oldgroup", "val" => $module->idgroup));
}
$record_identifier = $this->get_entity_identifier('', '', $module);
// query to change the user for the record
$qry = "\n\t\t\t\t\tupdate `" . $module->getTable() . "` \n\t\t\t\t\tset `iduser` = ?\n\t\t\t\t\twhere `" . $module->primary_key . "` = ?";
$this->query($qry, array($evctl->user_selector, $id));
//qry to delete from the group rel if data exists
$qry = "\n\t\t\t\t\tdelete from `" . $module->module_group_rel_table . "` \n\t\t\t\t\twhere \n\t\t\t\t\t`" . $module->primary_key . "` = ?";
$this->query($qry, array($id));
// add to data history
$do_data_history->addNew();
$do_data_history->id_referrer = $id;
$do_data_history->iduser = $_SESSION["do_user"]->iduser;
$do_data_history->idmodule = $module_id;
$do_data_history->date_modified = date("Y-m-d H:i:s");
$do_data_history->action = 'value_changes';
$do_data_history->idfields = (int) $evctl->fieldid;
$do_data_history->old_value = $old_assigned_to;
$do_data_history->new_value = $new_assigned_to;
$do_data_history->add();
// add to feed
$do_feed_queue->add_feed_queue($id, $module_id, $record_identifier, 'changed_assigned_to', $feed_other_assigne);
}
} elseif ($transfer_to_group === true) {
$do_group = new Group();
$do_group->getId((int) $evctl->group_selector);
$new_assigned_to = $do_group->group_name;
foreach ($record_ids as $id) {
$module->getId($id);
$old_assigned_to = $module->assigned_to;
if ($module->idgroup > 0) {
$feed_other_assigne = array("related" => "group", "data" => array("key" => "oldgroup", "val" => $module->idgroup));
}
$feed_other_assigne = array("related" => "group", "data" => array("key" => "newgroup", "val" => (int) $evctl->group_selector));
$record_identifier = $this->get_entity_identifier('', '', $module);
// query to change the iduser to 0 for the record
$qry = "\n\t\t\t\t\tupdate `" . $module->getTable() . "` \n\t\t\t\t\tset `iduser` = 0 \n\t\t\t\t\twhere `" . $module->primary_key . "` = ?";
$this->query($qry, array($id));
// now check if the record is already assigned to a different group then update else add a new entry
$qry_check = "\n\t\t\t\t\tselect * from `" . $module->module_group_rel_table . "` \n\t\t\t\t\twhere \n\t\t\t\t\t`" . $module->primary_key . "` = ?";
$this->query($qry_check, array($id));
if ($this->getNumRows() > 0) {
$qry = "\n\t\t\t\t\t\tupdate `" . $module->module_group_rel_table . "` \n\t\t\t\t\t\tset `idgroup` = ?\n\t\t\t\t\t\twhere `" . $module->primary_key . "` = ?";
$this->query($qry, array($evctl->group_selector, $id));
} else {
$this->insert($module->module_group_rel_table, array($module->primary_key => $id, 'idgroup' => $evctl->group_selector));
}
// add to data history
$do_data_history->addNew();
$do_data_history->id_referrer = $id;
$do_data_history->iduser = $_SESSION["do_user"]->iduser;
$do_data_history->idmodule = $module_id;
$do_data_history->date_modified = date("Y-m-d H:i:s");
$do_data_history->action = 'value_changes';
$do_data_history->idfields = (int) $evctl->fieldid;
$do_data_history->old_value = $old_assigned_to;
$do_data_history->new_value = $new_assigned_to;
$do_data_history->add();
// add to feed
$do_feed_queue->add_feed_queue($id, $module_id, $record_identifier, 'changed_assigned_to', $feed_other_assigne);
//.........这里部分代码省略.........