/** * load and create SalesChannels */ protected function loadSalesChannels() { $organization = $this->manager->getRepository('OroOrganizationBundle:Organization')->getFirst(); $i = 1; foreach ($this->data as $values) { $channel = new SalesChannel($values['name']); $channel->setChannelType($values['type']); $channel->setOwner($organization); $this->manager->persist($channel); $this->setReference('marello_sales_channel_' . $i, $channel); $i++; } $this->manager->flush(); }
/** * @ORM\PrePersist */ public function prePersist() { $this->createdAt = $this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC')); $this->salesChannelName = $this->salesChannel->getName(); }