Пример #1
0
 public function testWasSyncedAtLeastOnce()
 {
     $channel = new Channel();
     $status = new Status();
     $status->setChannel($channel)->setCode(Status::STATUS_COMPLETED);
     $this->assertFalse(FormUtils::wasSyncedAtLeastOnce($channel));
     $channel->addStatus($status);
     $this->assertTrue(FormUtils::wasSyncedAtLeastOnce($channel));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach ($this->data as $data) {
         $status = new Status();
         $status->setChannel($this->getReference($data['channel']));
         $status->setCode($data['status']);
         $status->setConnector($data['connector']);
         $status->setDate(new \DateTime($data['date'], new \DateTimeZone('UTC')));
         $status->setMessage($data['message']);
         $this->setReference($data['reference'], $status);
         $manager->persist($status);
     }
     $manager->flush();
 }
 /**
  * @param ChannelRepository $repository
  * @param Channel $integration
  * @param string $connector
  */
 protected function addInitialStatus(ChannelRepository $repository, Channel $integration, $connector)
 {
     /** @var MagentoSoapTransport $transport */
     $transport = $integration->getTransport();
     $syncStartDate = $transport->getSyncStartDate();
     $now = new \DateTime('now', new \DateTimeZone('UTC'));
     $status = new Status();
     $status->setData([AbstractInitialProcessor::INITIAL_SYNCED_TO => $syncStartDate->format(\DateTime::ISO8601)]);
     $status->setConnector($connector);
     $status->setDate($now);
     $status->setChannel($integration);
     $status->setCode(Status::STATUS_COMPLETED);
     $status->setMessage('Automatically added initial connector status.');
     $repository->addStatus($integration, $status);
 }