public function testGetEmail() { $quote = new Quote(); $this->assertEmpty($quote->getEmail()); $accountUser = new AccountUser(); $accountUser->setEmail('test'); $quote->setAccountUser($accountUser); $this->assertEquals('test', $quote->getEmail()); }
/** * @param int $ownerId * @param int $accountUserId * @param int $accountId * @param QuoteProduct[] $items * @param bool $locked * @return Quote */ protected function getQuote($ownerId, $accountUserId = null, $accountId = null, array $items = [], $locked = false) { $quote = new Quote(); $quote->setOwner($this->getEntity('Oro\\Bundle\\UserBundle\\Entity\\User', $ownerId)); if (null !== $accountUserId) { $quote->setAccountUser($this->getEntity('OroB2B\\Bundle\\AccountBundle\\Entity\\AccountUser', $accountUserId)); } if (null !== $accountId) { $quote->setAccount($this->getEntity('OroB2B\\Bundle\\AccountBundle\\Entity\\Account', $accountId)); } foreach ($items as $item) { $quote->addQuoteProduct($item); } $quote->setLocked($locked); return $quote; }
/** * {@inheritdoc} */ public function load(ObjectManager $manager) { $user = $this->getUser($manager); foreach (self::$items as $item) { /* @var $quote Quote */ $quote = new Quote(); $quote->setQid($item['qid'])->setOwner($user)->setOrganization($user->getOrganization()); if (!empty($item['account'])) { $quote->setAccount($this->getReference($item['account'])); } if (!empty($item['accountUser'])) { $quote->setAccountUser($this->getReference($item['accountUser'])); } foreach ($item['products'] as $sku => $items) { $this->addQuoteProduct($manager, $quote, $sku, $items); } $manager->persist($quote); $this->setReference($item['qid'], $quote); } $manager->flush(); }