本文整理汇总了PHP中Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getParentsSlugs方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface::getParentsSlugs方法的具体用法?PHP ThemeInterface::getParentsSlugs怎么用?PHP ThemeInterface::getParentsSlugs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Bundle\ThemeBundle\Model\ThemeInterface
的用法示例。
在下文中一共展示了ThemeInterface::getParentsSlugs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getThemeHierarchy
/**
* {@inheritdoc}
*/
public function getThemeHierarchy(ThemeInterface $theme)
{
$parents = [];
$parentsSlugs = $theme->getParentsSlugs();
foreach ($parentsSlugs as $parentName) {
$parents = array_merge($parents, $this->getThemeHierarchy($this->getTheme($parentName)));
}
return array_merge([$theme], $parents);
}
示例2:
function it_returns_theme_list_in_hierarchized_order(ThemeRepositoryInterface $themeRepository, ThemeInterface $firstTheme, ThemeInterface $secondTheme)
{
$firstTheme->getSlug()->willReturn("foo/bar1");
$firstTheme->getParentsSlugs()->willReturn(["foo/bar2"]);
$secondTheme->getSlug()->willReturn("foo/bar2");
$secondTheme->getParentsSlugs()->willReturn([]);
$themeRepository->findOneBySlug("foo/bar1")->willReturn($firstTheme);
$themeRepository->findOneBySlug("foo/bar2")->willReturn($secondTheme);
$this->getThemeHierarchy($firstTheme)->shouldReturn([$firstTheme, $secondTheme]);
}