本文整理汇总了PHP中Oro\Bundle\UserBundle\Entity\User::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getId方法的具体用法?PHP User::getId怎么用?PHP User::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\UserBundle\Entity\User
的用法示例。
在下文中一共展示了User::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGet
/**
* @depends testCreate
* @param integer $id
* @return array
*/
public function testGet($id)
{
$result = $this->soapClient->getPartner($id);
$partner = $this->valueToArray($result);
$this->assertArrayIntersectEquals(['id' => $id, 'partnerCondition' => $this->partnerCreateData['partnerCondition'], 'status' => $this->partnerCreateData['status'], 'account' => $this->getReference('orocrm_partner:test_account_1')->getId(), 'owner' => $this->adminUser->getId()], $partner);
$this->assertArrayHasKey('startDate', $partner);
$this->assertNotEmpty($partner['startDate']);
return $partner;
}
示例2: isCurrentUser
/**
* Returns true if passed user is currently authenticated
*
* @param User $user
* @return bool
*/
protected function isCurrentUser(User $user)
{
$token = $this->security->getToken();
$currentUser = $token ? $token->getUser() : null;
if ($user->getId() && is_object($currentUser)) {
return $currentUser->getId() == $user->getId();
}
return false;
}
示例3: testGetPermissionsWithEntities
public function testGetPermissionsWithEntities()
{
$this->client->request('GET', $this->getUrl('oro_api_get_user_permissions', ['id' => $this->user->getId(), 'entities' => 'Oro\\Bundle\\UserBundle\\Entity\\User']));
$result = $this->getJsonResponseContent($this->client->getResponse(), 200);
$this->assertCount(1, $result, "Result should contains only permissions for one entity");
$this->client->request('GET', $this->getUrl('oro_api_get_user_permissions', ['id' => $this->user->getId(), 'entities' => implode(',', ['user', 'Oro\\Bundle\\OrganizationBundle\\Entity\\Organization'])]));
$result = $this->getJsonResponseContent($this->client->getResponse(), 200);
$this->assertCount(2, $result, "Result should contains only permissions for two entities");
}
示例4: testGet
/**
* @depends testPost
* @param integer $id
* @return array
*/
public function testGet($id)
{
$this->client->request('GET', $this->getUrl('orocrm_partner_api_get_partner', ['id' => $id]), [], [], $this->generateWsseAuthHeader());
$partner = $this->getJsonResponseContent($this->client->getResponse(), 200);
$this->assertArrayIntersectEquals(['partnerCondition' => $this->partnerPostData['partnerCondition'], 'status' => $this->partnerPostData['status'], 'account' => $this->partnerPostData['account'], 'owner' => $this->adminUser->getId()], $partner);
$this->assertArrayHasKey('startDate', $partner);
$this->assertNotEmpty($partner['startDate']);
$this->assertArrayHasKey('id', $partner);
$this->assertGreaterThan(0, $partner['id']);
return $partner;
}
示例5: assign
/**
* Assign new assignee (User) to ticket
* @param OroUser $newAssignee
* @return void
*/
public function assign(OroUser $newAssignee)
{
if (is_null($this->assignee) || $newAssignee->getId() != $this->assignee->getId()) {
$this->processAssign($newAssignee);
$this->raise(new TicketAssigneeWasChanged($this->uniqueId, $this->subject, $this->getAssigneeFullName()));
}
}
示例6: createGridViewLabel
/**
* @param User $currentUser
* @param GridView $gridView
*
* @return string
*/
protected function createGridViewLabel(User $currentUser, GridView $gridView)
{
if ($gridView->getOwner()->getId() === $currentUser->getId()) {
return $gridView->getName();
}
return $this->translator->trans('oro.datagrid.gridview.shared_by', ['%name%' => $gridView->getName(), '%owner%' => $gridView->getOwner()->getUsername()]);
}
示例7: getBusinessUnitsTree
/**
* Build business units tree for user page
*
* @param User $user
* @return array
*/
public function getBusinessUnitsTree(User $user = null)
{
$businessUnits = $this->createQueryBuilder('businessUnit')->select(array('businessUnit.id', 'businessUnit.name', 'IDENTITY(businessUnit.owner) parent'));
if ($user && $user->getId()) {
$units = $user->getBusinessUnits()->map(function (BusinessUnit $businessUnit) {
return $businessUnit->getId();
});
$units = $units->toArray();
if ($units) {
$businessUnits->addSelect('CASE WHEN businessUnit.id IN (:userUnits) THEN 1 ELSE 0 END as hasUser');
$businessUnits->setParameter(':userUnits', $units);
}
}
$businessUnits = $businessUnits->getQuery()->getArrayResult();
$children = array();
foreach ($businessUnits as &$businessUnit) {
$parent = $businessUnit['parent'] ?: 0;
$children[$parent][] =& $businessUnit;
}
unset($businessUnit);
foreach ($businessUnits as &$businessUnit) {
if (isset($children[$businessUnit['id']])) {
$businessUnit['children'] = $children[$businessUnit['id']];
}
}
unset($businessUnit);
if (isset($children[0])) {
$children = $children[0];
}
return $children;
}
示例8: getDefaultAssigneeId
/**
* @return int|null
*/
public function getDefaultAssigneeId()
{
if (is_null($this->defaultAssignee)) {
return null;
}
return $this->defaultAssignee->getId();
}
示例9: assertOrderSave
/**
* @param Crawler $crawler
* @param User $owner
*/
protected function assertOrderSave(Crawler $crawler, User $owner)
{
$form = $crawler->selectButton('Save and Close')->form(['orob2b_order_type[owner]' => $owner->getId()]);
$this->client->followRedirects(true);
$crawler = $this->client->submit($form);
$result = $this->client->getResponse();
$this->assertHtmlResponseStatusCodeEquals($result, 200);
$html = $crawler->html();
$this->assertContains('Order has been saved', $html);
$this->assertViewPage($crawler, $owner);
}
示例10: getEmailUserList
/**
* @param User $user
* @param Organization $organization
* @param array $folderTypes
* @param bool $isSeen
* @return array
*/
public function getEmailUserList(User $user, Organization $organization, array $folderTypes = [], $isSeen = null)
{
$qb = $this->createQueryBuilder('eu');
$qb->join('eu.folders', 'f')->join('f.origin', 'o')->andWhere($qb->expr()->eq('eu.owner', $user->getId()))->andWhere($qb->expr()->eq('eu.organization', $organization->getId()))->andWhere($qb->expr()->eq('o.isActive', ':active'))->setParameter('active', true);
if ($folderTypes) {
$qb->andWhere($qb->expr()->in('f.type', $folderTypes));
}
if ($isSeen !== null) {
$qb->andWhere($qb->expr()->eq('eu.seen', ':seen'))->setParameter('seen', (bool) $isSeen);
}
return $qb->getQuery()->getResult();
}
示例11: getBusinessUnitIds
/**
* Get business units ids for current user for current access level
*
* @return array
* value -> business unit id
*/
protected function getBusinessUnitIds()
{
if (AccessLevel::SYSTEM_LEVEL == $this->accessLevel) {
return $this->businessUnitManager->getBusinessUnitIds();
} elseif (AccessLevel::LOCAL_LEVEL == $this->accessLevel) {
return $this->treeProvider->getTree()->getUserBusinessUnitIds($this->currentUser->getId(), $this->getOrganizationContextId());
} elseif (AccessLevel::DEEP_LEVEL === $this->accessLevel) {
return $this->treeProvider->getTree()->getUserSubordinateBusinessUnitIds($this->currentUser->getId(), $this->getOrganizationContextId());
} elseif (AccessLevel::GLOBAL_LEVEL === $this->accessLevel) {
return $this->businessUnitManager->getBusinessUnitIds($this->getOrganizationContextId());
}
return [];
}
示例12: isApplicableEmail
/**
* @param EmailHeader $email
* @param string $folderType
* @param User|null $user
* @param OrganizationInterface $organization
*
* @return bool
*/
protected function isApplicableEmail(EmailHeader $email, $folderType, $user = null, $organization = null)
{
if ($user === null) {
return $this->isKnownSender($email) && $this->isKnownRecipient($email);
}
if ($user instanceof User) {
if ($organization && !$this->checkOrganization($email, $folderType, $organization)) {
return false;
}
if ($folderType === FolderType::SENT) {
return $this->isUserSender($user->getId(), $email) && $this->isKnownRecipient($email);
} else {
return $this->isKnownSender($email) && $this->isUserRecipient($user->getId(), $email);
}
} elseif ($user instanceof Mailbox) {
if ($folderType === FolderType::SENT) {
return $this->isMailboxSender($user->getId(), $email);
} else {
return $this->isMailboxRecipient($user->getId(), $email);
}
}
return false;
}
示例13: canUserBeSetAsOwner
/**
* Checks if user can be set as owner by given user
*
* @param User $currentUser
* @param User $newUser
* @param string $accessLevel
* @param OwnerTreeProvider $treeProvider
* @param Organization $organization
*
* @return bool
*/
public function canUserBeSetAsOwner(User $currentUser, User $newUser, $accessLevel, OwnerTreeProvider $treeProvider, Organization $organization)
{
$userId = $newUser->getId();
if ($accessLevel == AccessLevel::SYSTEM_LEVEL) {
return true;
} elseif ($accessLevel == AccessLevel::BASIC_LEVEL && $userId == $currentUser->getId()) {
return true;
} elseif ($accessLevel == AccessLevel::GLOBAL_LEVEL && $newUser->getOrganizations()->contains($organization)) {
return true;
} else {
$resultBuIds = [];
if ($accessLevel == AccessLevel::LOCAL_LEVEL) {
$resultBuIds = $treeProvider->getTree()->getUserBusinessUnitIds($currentUser->getId(), $organization->getId());
} elseif ($accessLevel == AccessLevel::DEEP_LEVEL) {
$resultBuIds = $treeProvider->getTree()->getUserSubordinateBusinessUnitIds($currentUser->getId(), $organization->getId());
}
if (!empty($resultBuIds)) {
$newUserBuIds = $treeProvider->getTree()->getUserBusinessUnitIds($userId, $organization->getId());
$intersectBUIds = array_intersect($resultBuIds, $newUserBuIds);
return !empty($intersectBUIds);
}
}
return false;
}
示例14: getCountNewEmails
/**
* Get count new emails
*
* @param User $user
*
* @return mixed
*/
public function getCountNewEmails(User $user)
{
return $this->createQueryBuilder('e')->select('COUNT(DISTINCT e)')->leftJoin('e.emailUsers', 'eu')->where('eu.organization = :organizationId')->andWhere('eu.owner = :ownerId')->andWhere('eu.seen = :seen')->setParameter('organizationId', $user->getOrganization()->getId())->setParameter('ownerId', $user->getId())->setParameter('seen', false)->getQuery()->getSingleScalarResult();
}
示例15: createUserView
/**
* @param User $user
* @return array
*/
protected function createUserView(User $user)
{
return ['id' => $user->getId(), 'url' => $this->router->generate('oro_user_view', array('id' => $user->getId())), 'fullName' => $this->entityNameResolver->getName($user), 'avatar' => $user->getAvatar() ? $this->attachmentManager->getFilteredImageUrl($user->getAvatar(), 'avatar_xsmall') : null, 'permissions' => array('view' => $this->securityFacade->isGranted('VIEW', $user))];
}