/** * Gets email references of current one * * @param EntityManager $entityManager * @param Email $entity * * @return array */ public function getEmailReferences(EntityManager $entityManager, Email $entity) { $result = []; $refs = $entity->getRefs(); if ($refs) { /** @var QueryBuilder $queryBuilder */ $queryBuilder = $entityManager->getRepository('OroEmailBundle:Email')->createQueryBuilder('e'); $criteria = new Criteria(); $criteria->where($criteria->expr()->in('messageId', $refs)); $queryBuilder->addCriteria($criteria); $result = $queryBuilder->getQuery()->getResult(); } return $result; }
/** * @param Email $email * @param string $refs */ protected function processRefs(Email $email, $refs) { if ($email->getId()) { if (!$this->areRefsEqual($email->getRefs(), $refs)) { throw $this->createInvalidPropertyException('Refs', $this->convertRefsToString($email->getRefs()), $this->convertRefsToString($refs)); } } else { $email->setRefs($refs); } }
/** * @dataProvider refsDataProvider * @param string $set * @param array $get */ public function testRefsGetterAndSetter($set, $get) { $entity = new Email(); $entity->setRefs($set); $this->assertEquals($get, $entity->getRefs()); }