/**
  * Test related method
  */
 public function testGetSetAttributeAsLabel()
 {
     $attribute = $this->getAttributeMock();
     $this->assertNull($this->family->getAttributeAsLabel());
     $this->assertEntity($this->family->setAttributeAsLabel($attribute));
     $this->assertEquals($attribute, $this->family->getAttributeAsLabel());
 }
 /**
  * {@inheritdoc}
  *
  * @return Family
  */
 protected function createEntity(array $data)
 {
     $family = new Family();
     $family->setCode('mycode');
     foreach ($this->getLabels($data) as $locale => $label) {
         $translation = $family->getTranslation($locale);
         $translation->setLabel($label);
         $family->addTranslation($translation);
     }
     $codes = array('attribute1', 'attribute2', 'attribute3');
     $attributes = array();
     foreach ($codes as $code) {
         $attribute = new Attribute();
         $attribute->setCode($code);
         $family->addAttribute($attribute);
         $attributes[] = $attribute;
     }
     $family->setAttributeAsLabel(current($attributes));
     $channel1 = new Channel();
     $channel1->setCode('channel1');
     $channel2 = new Channel();
     $channel2->setCode('channel2');
     $requirements = array(array('attribute' => $attributes[0], 'channel' => $channel1, 'required' => true), array('attribute' => $attributes[1], 'channel' => $channel1, 'required' => true), array('attribute' => $attributes[2], 'channel' => $channel1, 'required' => false), array('attribute' => $attributes[0], 'channel' => $channel2, 'required' => true), array('attribute' => $attributes[1], 'channel' => $channel2, 'required' => false), array('attribute' => $attributes[2], 'channel' => $channel2, 'required' => true));
     $attrRequirements = array();
     foreach ($requirements as $requirement) {
         $attrRequirement = new AttributeRequirement();
         $attrRequirement->setAttribute($requirement['attribute']);
         $attrRequirement->setChannel($requirement['channel']);
         $attrRequirement->setRequired($requirement['required']);
         $attrRequirements[] = $attrRequirement;
     }
     $family->setAttributeRequirements($attrRequirements);
     return $family;
 }
 /**
  * Create and configure a family intance
  *
  * @return Family
  */
 public function createFamily()
 {
     $family = new Family();
     $identifier = $this->productManager->getIdentifierAttribute();
     $family->addAttribute($identifier);
     $family->setAttributeAsLabel($identifier);
     foreach ($this->getChannels() as $channel) {
         $family->addAttributeRequirement($this->factory->createAttributeRequirement($identifier, $channel, true));
     }
     return $family;
 }
 /**
  * {@inheritDoc}
  */
 public function setAttributeAsLabel(\Pim\Bundle\CatalogBundle\Model\AttributeInterface $attributeAsLabel)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setAttributeAsLabel', array($attributeAsLabel));
     return parent::setAttributeAsLabel($attributeAsLabel);
 }