eZ Publish の Controller まわり


特定ロケーションの viewCache の破棄

$this->container->get( 'ezpublish.http_cache.purger' )->purge( $locationId );

すべての viewCache の破棄

$this->container->get( 'ezpublish.http_cache.purger' )->purgeAll();

子のロケーション ID の取得

$currentLocation = $locationService->loadLocation( $locationId );
$currentLocationChildren = $locationService->loadLocationChildren(
    $currentLocation, $offset = 0, $limit = -1
);
$childrenLocatinoId = array();
foreach ( $currentLocationChildren->locations as $childLocation )
{
    $childrenLocatinoId[] = $childLocation->contentInfo->mainLocationId;
}

認証済みユーザーの確認

$securityToken = $this->container->get('security.context')->getToken();
$userAuth = $securityToken->isAuthenticated(); // return true or false

Symfony ロケールを eZ Publish に変換

$symfonyLocale = $this->getRequest()->get( '_locale' );
$localeConverter = $this->container->get( 'ezpublish.locale.converter' );
$ezLocale = $ezLocale = $localeConverter->convertToEz( $symfonyLocale );