本文整理汇总了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']);
}
}