/** * {@inheritdoc} * * @return Channel */ protected function createEntity(array $data) { $channel = new Channel(); $channel->setCode($data['code']); $channel->setLabel($data['label']); foreach ($data['currencies'] as $currencyCode) { $currency = $this->createCurrency($currencyCode); $channel->addCurrency($currency); } foreach ($data['locales'] as $localeCode) { $locale = $this->createLocale($localeCode); $channel->addLocale($locale); } $category = $this->createCategory($data['category']); $channel->setCategory($category); $channel->setConversionUnits(array('weight' => 'KILOGRAM', 'washing_temperature' => null)); return $channel; }
/** * @param Channel $channel * @param TableNode $conversionUnits * * @Given /^the following (channel "(?:[^"]*)") conversion options:$/ */ public function theFollowingChannelConversionOptions(Channel $channel, TableNode $conversionUnits) { $channel->setConversionUnits($conversionUnits->getRowsHash()); // TODO replace by call to a saver $this->flush(); }
/** * @param Channel $channel * @param TableNode $conversionUnits * * @Given /^the following (channel "(?:[^"]*)") conversion options:$/ */ public function theFollowingChannelConversionOptions(Channel $channel, TableNode $conversionUnits) { $channel->setConversionUnits($conversionUnits->getRowsHash()); $this->flush(); }
/** * @param Channel $channel * @param TableNode $conversionUnits * * @Given /^the following (channel "(?:[^"]*)") conversion options:$/ */ public function theFollowingChannelConversionOptions(Channel $channel, TableNode $conversionUnits) { $channel->setConversionUnits($conversionUnits->getRowsHash()); $this->getContainer()->get('pim_catalog.saver.channel')->save($channel); }
/** * {@inheritDoc} */ public function setConversionUnits(array $conversionUnits) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setConversionUnits', array($conversionUnits)); return parent::setConversionUnits($conversionUnits); }