/**
  * Test getter/setter for code property
  */
 public function testCode()
 {
     $this->assertEmpty($this->group->getCode());
     // Change value and assert new
     $newCode = 'test-code';
     $this->assertEntity($this->group->setCode($newCode));
     $this->assertEquals($newCode, $this->group->getCode());
 }
 /**
  * @param AttributeGroup $group
  *
  * @return array
  */
 public function getAllSources(AttributeGroup $group = null)
 {
     $sources = [];
     if ($this->isValid()) {
         $groups = $this->attributeGroupManager->getAllGroups();
         foreach ($groups as $group) {
             $sources[] = ['id' => $group->getCode(), 'name' => $group->getCode()];
         }
     }
     return $sources;
 }
 /**
  * Register a new group mapping.
  *
  * @param AttributeGroup $pimGroup
  * @param Family         $pimFamily
  * @param integer        $magentoGroupId
  * @param string         $magentoUrl
  */
 public function registerGroupMapping(AttributeGroup $pimGroup, Family $pimFamily, $magentoGroupId, $magentoUrl)
 {
     $groupMapping = $this->getEntityRepository()->findOneBy(['pimGroupCode' => $pimGroup->getCode(), 'pimFamilyCode' => $pimFamily->getCode(), 'magentoUrl' => $magentoUrl]);
     $magentoGroupMapping = new $this->className();
     if ($groupMapping) {
         $magentoGroupMapping = $groupMapping;
     }
     $magentoGroupMapping->setPimGroupCode($pimGroup->getCode());
     $magentoGroupMapping->setPimFamilyCode($pimFamily->getCode());
     $magentoGroupMapping->setMagentoGroupId($magentoGroupId);
     $magentoGroupMapping->setMagentoUrl($magentoUrl);
     $this->objectManager->persist($magentoGroupMapping);
     $this->objectManager->flush();
 }
 public function let(ObjectManager $objectManager, EntityRepository $entityRepository, Family $family, AttributeGroup $group)
 {
     $this->beConstructedWith($objectManager, 'Pim\\Bundle\\MagentoConnectorBundle\\Entity\\MagentoAttributeMapping');
     $objectManager->getRepository('Pim\\Bundle\\MagentoConnectorBundle\\Entity\\MagentoAttributeMapping')->willReturn($entityRepository);
     $group->getCode()->willReturn(12);
     $family->getCode()->willReturn(5);
 }
 /**
  * {@inheritDoc}
  */
 public function getCode()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCode', array());
     return parent::getCode();
 }