本文整理汇总了PHP中Oro\Bundle\UserBundle\Entity\User::getOrganization方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getOrganization方法的具体用法?PHP User::getOrganization怎么用?PHP User::getOrganization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\UserBundle\Entity\User
的用法示例。
在下文中一共展示了User::getOrganization方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSuccess
/**
* "Success" form handler
*
* @param RFPRequest $entity
* @return bool
*/
protected function onSuccess(RFPRequest $entity)
{
$quote = new Quote();
$quote->setRequest($entity)->setOwner($this->user)->setAccount($entity->getAccount())->setAccountUser($entity->getAccountUser())->setOrganization($this->user->getOrganization());
foreach ($entity->getRequestProducts() as $requestProduct) {
$quoteProduct = new QuoteProduct();
$quoteProduct->setProduct($requestProduct->getProduct())->setType(QuoteProduct::TYPE_REQUESTED)->setCommentAccount($requestProduct->getComment());
foreach ($requestProduct->getRequestProductItems() as $requestProductItem) {
$quoteProductRequest = new QuoteProductRequest();
$quoteProductRequest->setQuantity($requestProductItem->getQuantity())->setPrice($requestProductItem->getPrice())->setProductUnit($requestProductItem->getProductUnit())->setRequestProductItem($requestProductItem);
$quoteProduct->addQuoteProductRequest($quoteProductRequest);
$quoteProductOffer = new QuoteProductOffer();
$quoteProductOffer->setQuantity($requestProductItem->getQuantity())->setProductUnit($requestProductItem->getProductUnit())->setPriceType(QuoteProductOffer::PRICE_TYPE_UNIT)->setAllowIncrements(true);
$quoteProduct->addQuoteProductOffer($quoteProductOffer);
}
$quote->addQuoteProduct($quoteProduct);
}
try {
$this->manager->persist($quote);
$this->manager->flush();
$this->quote = $quote;
} catch (DBALException $e) {
$this->exception = $e;
return false;
}
return true;
}
示例2: createUserInternalOrigin
/**
* @param User $emailOwner
* @param OrganizationInterface $organization
*
* @return InternalEmailOrigin
*/
protected function createUserInternalOrigin(User $emailOwner, OrganizationInterface $organization = null)
{
$organization = $organization ? $organization : $emailOwner->getOrganization();
$originName = InternalEmailOrigin::BAP . '_User_' . $emailOwner->getId();
$outboxFolder = new EmailFolder();
$outboxFolder->setType(FolderType::SENT)->setName(FolderType::SENT)->setFullName(FolderType::SENT);
$origin = new InternalEmailOrigin();
$origin->setName($originName)->addFolder($outboxFolder)->setOwner($emailOwner)->setOrganization($organization);
$emailOwner->addEmailOrigin($origin);
$this->getEntityManager()->persist($origin);
$this->getEntityManager()->persist($emailOwner);
return $origin;
}
示例3: testOrganization
public function testOrganization()
{
$entity = new User();
$organization = new Organization();
$this->assertNull($entity->getOrganization());
$entity->setOrganization($organization);
$this->assertSame($organization, $entity->getOrganization());
}
示例4: createCalendarsForNewUser
/**
* @param EntityManager $em
* @param UnitOfWork $uow
* @param User $user
*/
protected function createCalendarsForNewUser($em, $uow, $user)
{
$owningOrganization = $user->getOrganization();
$this->createCalendar($em, $uow, $user, $owningOrganization);
foreach ($user->getOrganizations() as $organization) {
if ($organization->getId() !== $owningOrganization->getId()) {
$this->createCalendar($em, $uow, $user, $organization);
}
}
}
示例5: 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();
}
示例6: getDefaultUserCalendar
/**
* @param User $user
* @return null|Calendar
*/
protected function getDefaultUserCalendar(User $user)
{
return $this->calendarRepository->findDefaultCalendar($user->getId(), $user->getOrganization()->getId());
}