|
9 | 9 | use Pim\Bundle\FlexibleEntityBundle\Model\AbstractAttribute; |
10 | 10 | use Pim\Bundle\CatalogBundle\Manager\ProductManager; |
11 | 11 | use Pim\Bundle\CatalogBundle\Manager\CurrencyManager; |
12 | | -use Pim\Bundle\CatalogBundle\Entity\Channel; |
13 | 12 | use Pim\Bundle\CatalogBundle\Entity\Family; |
14 | 13 | use Pim\Bundle\CatalogBundle\Entity\Locale; |
15 | 14 | use Pim\Bundle\CatalogBundle\Model\Media; |
@@ -356,33 +355,33 @@ protected function addValues(AbstractAttribute $attribute) |
356 | 355 | if ($attribute->isScopable()) { |
357 | 356 | foreach ($locale->getChannels() as $channel) { |
358 | 357 | $key = $attribute->getCode().'_'.$channel->getCode(); |
359 | | - $this->values[$key] = $this->createValue($attribute, $locale, $channel); |
| 358 | + $this->values[$key] = $this->createValue($attribute, $locale->getCode(), $channel->getCode()); |
360 | 359 | } |
361 | 360 | } else { |
362 | | - $this->values[$attribute->getCode()] = $this->createValue($attribute, $locale); |
| 361 | + $this->values[$attribute->getCode()] = $this->createValue($attribute, $locale->getCode()); |
363 | 362 | } |
364 | 363 | } |
365 | 364 |
|
366 | 365 | /** |
367 | 366 | * Create a value |
368 | 367 | * |
369 | 368 | * @param AbstractAttribute $attribute |
370 | | - * @param Locale $locale |
371 | | - * @param Channel $channel |
| 369 | + * @param string $localeCode |
| 370 | + * @param string $channelCode |
372 | 371 | * |
373 | 372 | * @return ProductValueInterface |
374 | 373 | */ |
375 | | - protected function createValue(AbstractAttribute $attribute, Locale $locale, Channel $channel = null) |
| 374 | + protected function createValue(AbstractAttribute $attribute, $localeCode = null, $channelCode = null) |
376 | 375 | { |
377 | 376 | $value = $this->productManager->createProductValue(); |
378 | 377 | $value->setAttribute($attribute); |
379 | 378 |
|
380 | 379 | if ($attribute->isLocalizable()) { |
381 | | - $value->setLocale($locale); |
| 380 | + $value->setLocale($localeCode); |
382 | 381 | } |
383 | 382 |
|
384 | | - if ($channel && $attribute->isScopable()) { |
385 | | - $value->setScope($channel->getCode()); |
| 383 | + if ($attribute->isScopable()) { |
| 384 | + $value->setScope($channelCode); |
386 | 385 | } |
387 | 386 |
|
388 | 387 | if ('pim_catalog_price_collection' === $attribute->getAttributeType()) { |
|
0 commit comments