/** * Test getter for max attribute sort order */ public function testGetMaxAttributeSortOrder() { $max = 5; for ($i = 1; $i <= $max; $i++) { $attribute = new Attribute(); $attribute->setSortOrder($i); $this->group->addAttribute($attribute); } $this->assertEquals($this->group->getMaxAttributeSortOrder(), $max); }
/** * {@inheritdoc} * @return AttributeGroupInterface */ protected function createEntity(array $data) { $group = new AttributeGroup(); $group->setCode($data['code']); foreach ($this->getLabels($data) as $locale => $label) { $translation = $group->getTranslation($locale); $translation->setLabel($label); $group->addTranslation($translation); } $group->setSortOrder($data['sortOrder']); foreach ($this->getAttributes($data) as $attribute) { $group->addAttribute($attribute); } return $group; }
/** * {@inheritDoc} */ public function addAttribute(\Pim\Bundle\CatalogBundle\Model\AttributeInterface $attribute) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'addAttribute', array($attribute)); return parent::addAttribute($attribute); }