Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $statuses = array();
     // force id = 1
     $metadata = $manager->getClassMetaData(get_class(new ShippingStatus()));
     $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);
     // created
     $status = new ShippingStatus();
     $status->setId(ShippingStatus::STATUS_CREATED);
     $this->createStatusTranslation($manager, $status, 'Created', 'en');
     $this->createStatusTranslation($manager, $status, 'Erfasst', 'de');
     $this->createStatusTranslation($manager, $status, 'Erfasst', 'de_ch');
     $manager->persist($status);
     $statuses[ShippingStatus::STATUS_CREATED] = $status;
     // delivery note
     $status = new ShippingStatus();
     $status->setId(ShippingStatus::STATUS_DELIVERY_NOTE);
     $this->createStatusTranslation($manager, $status, 'Delivery note created', 'en');
     $this->createStatusTranslation($manager, $status, 'Lieferschein erstellt', 'de');
     $this->createStatusTranslation($manager, $status, 'Lieferschein erstellt', 'de_ch');
     $manager->persist($status);
     $statuses[ShippingStatus::STATUS_DELIVERY_NOTE] = $status;
     // shipped
     $status = new ShippingStatus();
     $status->setId(ShippingStatus::STATUS_SHIPPED);
     $this->createStatusTranslation($manager, $status, 'Shipped', 'en');
     $this->createStatusTranslation($manager, $status, 'Versandt', 'de');
     $this->createStatusTranslation($manager, $status, 'Versandt', 'de_ch');
     $manager->persist($status);
     $statuses[ShippingStatus::STATUS_SHIPPED] = $status;
     // canceled
     $status = new ShippingStatus();
     $status->setId(ShippingStatus::STATUS_CANCELED);
     $this->createStatusTranslation($manager, $status, 'Canceled', 'en');
     $this->createStatusTranslation($manager, $status, 'Storniert', 'de');
     $this->createStatusTranslation($manager, $status, 'Storniert', 'de_ch');
     $manager->persist($status);
     $statuses[ShippingStatus::STATUS_CANCELED] = $status;
     $manager->flush();
     return $statuses;
 }
Пример #2
0
 private function setUpTestData()
 {
     // initialize order data
     $this->data = new OrderDataSetup($this->em, $this->getItemFactory(), $this->getContactRepository());
     // load order-statuses
     $statusFixtures = new LoadShippingStatus();
     $shippingStatuses = $statusFixtures->load($this->em);
     $this->statusCreated = $shippingStatuses[ShippingStatus::STATUS_CREATED];
     $this->shippingAddress = clone $this->data->orderAddressDelivery;
     $this->shipping = new Shipping();
     $this->shipping->setNumber('00001');
     $this->shipping->setShippingNumber('432');
     $this->shipping->setStatus($this->statusCreated);
     $this->shipping->setOrder($this->data->order);
     $this->shipping->setChanged(new DateTime());
     $this->shipping->setCreated(new DateTime());
     $this->shipping->setCommission('shipping-commission');
     $this->shipping->setDeliveryAddress($this->shippingAddress);
     $this->shipping->setExpectedDeliveryDate(new DateTime('2015-01-01'));
     $this->shipping->setHeight(101);
     $this->shipping->setWidth(102);
     $this->shipping->setLength(103);
     $this->shipping->setWeight(10);
     $this->shipping->setNote('simple shipping note');
     $this->shipping->setTermsOfDeliveryContent($this->data->termsOfDelivery->getTerms());
     $this->shipping->setTermsOfPaymentContent($this->data->termsOfPayment->getTerms());
     $this->shipping->setTrackingId('abcd1234');
     $this->shipping->setTrackingUrl('http://www.tracking.url?token=abcd1234');
     $this->shipping->setBitmaskStatus($this->statusCreated->getId());
     $this->shipping->setInternalNote('Tiny internal note');
     $this->shipping2 = clone $this->shipping;
     $this->shipping2->setNumber('00002');
     $this->shipping2->setStatus($this->statusCreated);
     $this->shipping2->setBitmaskStatus($this->statusCreated->getId());
     $this->shippingAddress2 = clone $this->shippingAddress;
     $this->shipping2->setDeliveryAddress($this->shippingAddress2);
     $this->shippingItem = new ShippingItem();
     $this->shippingItem->setShipping($this->shipping);
     $this->shippingItem->setItem($this->data->item);
     $this->shippingItem->setQuantity(1);
     $this->shippingItem->setNote('shipping-item-note');
     $this->shipping->addShippingItem($this->shippingItem);
     // persist
     $this->em->persist($this->shipping);
     $this->em->persist($this->shipping2);
     $this->em->persist($this->shippingItem);
     $this->em->persist($this->shippingAddress);
     $this->em->persist($this->shippingAddress2);
 }