/**
  * @dataProvider toCsvDataProvider
  */
 public function testfromCSV($expected)
 {
     $coll = new ObjectCollection();
     $coll->setModel('\\Propel\\Tests\\Bookstore\\Book');
     $coll->fromCSV($expected);
     // fix modified columns order
     foreach ($coll as $book) {
         $book->resetModified();
     }
     $this->assertEquals($this->coll->getData(), $coll->getData());
 }
Exemplo n.º 2
0
 /**
  * @api
  *
  * @param \Propel\Runtime\Collection\ObjectCollection $orderItems
  * @param array $logContext
  * @param array $data
  *
  * @return array
  */
 public function triggerEventForNewItem(ObjectCollection $orderItems, array $logContext, array $data = [])
 {
     $orderItemsArray = $orderItems->getData();
     return $this->getFactory()->createLockedOrderStateMachine($logContext)->triggerEventForNewItem($orderItemsArray, $data);
 }
Exemplo n.º 3
0
 /**
  * @param \Propel\Runtime\Collection\ObjectCollection $entities
  * @param \Orm\Zed\Customer\Persistence\SpyCustomer $customer
  *
  * @return \Generated\Shared\Transfer\AddressesTransfer
  */
 protected function entityCollectionToTransferCollection(ObjectCollection $entities, SpyCustomer $customer)
 {
     $addressCollection = new AddressesTransfer();
     foreach ($entities->getData() as $address) {
         $addressTransfer = $this->entityToTransfer($address);
         if ($customer->getDefaultBillingAddress() === $address->getIdCustomerAddress()) {
             $addressTransfer->setIsDefaultBilling(true);
         }
         if ($customer->getDefaultShippingAddress() === $address->getIdCustomerAddress()) {
             $addressTransfer->setIsDefaultShipping(true);
         }
         $addressCollection->addAddress($addressTransfer);
     }
     return $addressCollection;
 }
Exemplo n.º 4
0
 /**
  * @param \Propel\Runtime\Collection\ObjectCollection $entities
  *
  * @return \Generated\Shared\Transfer\AddressesTransfer
  */
 protected function entityCollectionToTransferCollection(ObjectCollection $entities)
 {
     $addressTransferCollection = new AddressesTransfer();
     foreach ($entities->getData() as $entity) {
         $addressTransferCollection->addAddress($this->entityToAddressTransfer($entity));
     }
     return $addressTransferCollection;
 }