本文整理匯總了PHP中Pim\Component\Catalog\Model\GroupInterface::setCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP GroupInterface::setCode方法的具體用法?PHP GroupInterface::setCode怎麽用?PHP GroupInterface::setCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pim\Component\Catalog\Model\GroupInterface
的用法示例。
在下文中一共展示了GroupInterface::setCode方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_throws_an_error_if_type_is_unknown(GroupInterface $group)
{
$group->setCode('mycode')->shouldBeCalled();
$group->getId()->willReturn(null);
$values = ['code' => 'mycode', 'type' => 'UNKNOWN'];
$this->shouldThrow(new \InvalidArgumentException('Type "UNKNOWN" does not exist'))->during('update', [$group, $values, []]);
}
示例2:
function it_throws_an_exception_if_attribute_is_unknown($attributeRepository, GroupInterface $group)
{
$group->setCode('mycode')->shouldBeCalled();
$attributeRepository->findOneByIdentifier('foo')->willReturn(null);
$group->getId()->willReturn(null);
$values = ['code' => 'mycode', 'axis' => ['foo']];
$this->shouldThrow(new \InvalidArgumentException('Attribute "foo" does not exist'))->during('update', [$group, $values, []]);
}
示例3: Attribute
function it_throws_an_error_if_axis_is_updated(GroupInterface $variantGroup)
{
$variantGroup->setCode('mycode')->shouldBeCalled();
$variantGroup->getId()->willReturn(42);
$attribute = new Attribute();
$attribute->setCode('other');
$variantGroup->getAxisAttributes()->willReturn(new ArrayCollection([$attribute]));
$values = ['code' => 'mycode', 'axis' => ['main_color']];
$this->shouldThrow(new \InvalidArgumentException('Attributes: This property cannot be changed.'))->during('update', [$variantGroup, $values, []]);
}
示例4: setCode
/**
* @param GroupInterface $group
* @param string $code
*/
protected function setCode(GroupInterface $group, $code)
{
$group->setCode($code);
}
示例5: setCode
/**
* @param GroupInterface $variantGroup
* @param string $code
*/
protected function setCode(GroupInterface $variantGroup, $code)
{
$variantGroup->setCode($code);
}
示例6: setCode
/**
* @param GroupInterface $group
* @param array $data
*/
protected function setCode(GroupInterface $group, $data)
{
if (isset($data['code'])) {
$group->setCode($data['code']);
}
}