本文整理汇总了PHP中Oro\Bundle\EmailBundle\Entity\Email::getThread方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::getThread方法的具体用法?PHP Email::getThread怎么用?PHP Email::getThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EmailBundle\Entity\Email
的用法示例。
在下文中一共展示了Email::getThread方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getThreadEmails
/**
* Get emails in thread of current one
*
* @param EntityManager $entityManager
* @param Email $entity
*
* @return Email[]
*/
public function getThreadEmails(EntityManager $entityManager, Email $entity)
{
$thread = $entity->getThread();
if ($thread) {
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $entityManager->getRepository('OroEmailBundle:Email')->createQueryBuilder('e');
$criteria = new Criteria();
$criteria->where($criteria->expr()->eq('thread', $thread));
$criteria->orderBy(['sentAt' => Criteria::DESC]);
$queryBuilder->addCriteria($criteria);
$result = $queryBuilder->getQuery()->getResult();
} else {
$result = [$entity];
}
return $result;
}
示例2: updateRefs
/**
* Updates email references' threadId
*
* @param EntityManager $entityManager
* @param Email $entity
*/
protected function updateRefs(EntityManager $entityManager, Email $entity)
{
if ($entity->getThread()) {
/** @var Email $email */
foreach ($this->emailThreadProvider->getEmailReferences($this->em, $entity) as $email) {
if (!$email->getThread()) {
$email->setThread($entity->getThread());
$entityManager->persist($email);
}
}
}
}
示例3: setReplaedEmailId
/**
* @param Email $email
* @param $data
*
* @return mixed
*/
protected function setReplaedEmailId($email, $data)
{
if ($email->getThread()) {
$emails = $email->getThread()->getEmails();
// if there are just two email - add replayedEmailId to use on client side
if (count($emails) === 2) {
$data['replayedEmailId'] = $emails[0]->getId();
}
}
return $data;
}
示例4: prepareFlaggedEmailEntities
/**
* Prepare emails to set status. If need get all from thread
*
* @param Email $entity
* @param bool $checkThread Get threaded emails
*
* @return Email[]
*/
protected function prepareFlaggedEmailEntities(Email $entity, $checkThread)
{
$thread = $entity->getThread();
$emails = [$entity];
if ($checkThread && $thread) {
$emails = $thread->getEmails();
return $emails->toArray();
}
return $emails;
}
示例5: getAllEmailUsersByEmail
/**
* Gets array of EmailUser's by Email or EmailThread of this email depends on $checkThread flag
* for current user and organization or which have mailbox owner.
*
* @param Email $email
* @param User $user
* @param Organization $organization
* @param bool|false $checkThread
*
* @return EmailUser[]
*/
public function getAllEmailUsersByEmail(Email $email, User $user, Organization $organization, $checkThread = false)
{
$parameters = [];
$queryBuilder = $this->createQueryBuilder('eu')->join('eu.email', 'e');
if ($checkThread && ($thread = $email->getThread())) {
$queryBuilder->andWhere('e.thread = :thread');
$parameters['thread'] = $thread;
} else {
$queryBuilder->andWhere('eu.email = :email');
$parameters['email'] = $email;
}
$orx = $queryBuilder->expr()->orX();
$orx->add('eu.mailboxOwner IS NOT NULL')->add('eu.owner = :owner AND eu.organization = :organization');
return $queryBuilder->andWhere($orx)->setParameters(array_merge($parameters, ['owner' => $user, 'organization' => $organization]))->getQuery()->getResult();
}
示例6: addContextsToThread
/**
* @param EntityManager $em
* @param Email $email
* @param [] $contexts
*/
protected function addContextsToThread(EntityManager $em, Email $email, $contexts)
{
$thread = $email->getThread();
if ($thread) {
$relatedEmails = $em->getRepository(Email::ENTITY_CLASS)->findByThread($thread);
} else {
$relatedEmails = [$email];
}
if (count($contexts) > 0) {
foreach ($relatedEmails as $relatedEmail) {
foreach ($contexts as $context) {
$this->addAssociation($relatedEmail, $context);
}
}
}
}
示例7: processThread
/**
* @param Email $email
* @param EmailThread $thread
*/
protected function processThread(Email $email, EmailThread $thread)
{
if ($email->getId()) {
if (!$email->getThread() || $email->getThread()->getId() != $thread->getId()) {
throw $this->createInvalidPropertyException('Thread', $email->getThread() ? $email->getThread()->getId() : null, $thread->getId());
}
} else {
$email->setThread($thread);
}
}