コード例 #1
0
 /**
  * Remove an attribute from a group and link it to the default group
  *
  * @param AttributeGroupInterface $group
  * @param AttributeInterface      $attribute
  *
  * @throws \LogicException
  */
 public function removeAttribute(AttributeGroupInterface $group, AttributeInterface $attribute)
 {
     if (null === ($default = $this->repository->findDefaultAttributeGroup())) {
         throw new \LogicException('The default attribute group should exist.');
     }
     $group->removeAttribute($attribute);
     $attribute->setGroup($default);
     $this->attributeSaver->saveAll([$attribute]);
     $this->groupSaver->save($group);
 }