Skip to content

Commit

Permalink
Fix EZP-20509: Cache issues when creating content
Browse files Browse the repository at this point in the history
  • Loading branch information
dpobel committed Mar 25, 2013
1 parent f772be5 commit ee16772
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Controller/DemoController.php
Expand Up @@ -31,8 +31,8 @@ public function topMenuAction( $locationId, array $excludeContentTypes = array()
{
$response = new Response;
$response->setPublic();
$response->setMaxAge( 60 );
$location = $this->getRepository()->getLocationService()->loadLocation( $locationId );
$response->setSharedMaxAge( 86400 );
$response->headers->set( 'X-Location-Id', $locationId );

$excludeCriterion = array();
if ( !empty( $excludeContentTypes ) )
Expand All @@ -46,7 +46,6 @@ public function topMenuAction( $locationId, array $excludeContentTypes = array()
}
}
$criteria = array(
new Criterion\Subtree( $location->pathString ),
new Criterion\ParentLocationId( $locationId ),
new Criterion\Visibility( Criterion\Visibility::VISIBLE )
);
Expand Down Expand Up @@ -96,9 +95,12 @@ public function topMenuAction( $locationId, array $excludeContentTypes = array()
*/
public function latestContentAction( $pathString, $contentTypeIdentifier, $limit, array $excludeLocations = array() )
{
$tmp = explode( '/', trim( $pathString, '/' ) );
$locationId = end( $tmp );
$response = new Response;
$response->setPublic();
$response->setMaxAge( 60 );
$response->setSharedMaxAge( 86400 );
$response->headers->set( 'X-Location-Id', $locationId );

$contentType = $this->getRepository()->getContentTypeService()->loadContentTypeByIdentifier( $contentTypeIdentifier );

Expand Down Expand Up @@ -146,7 +148,8 @@ public function footerAction( $locationId )
{
$response = new Response;
$response->setPublic();
$response->setMaxAge( 60 );
$response->setSharedMaxAge( 86400 );
$response->headers->set( 'X-Location-Id', $locationId );

$location = $this->getRepository()->getLocationService()->loadLocation( $locationId );
$content = $this->getRepository()->getContentService()->loadContent( $location->contentId );
Expand Down

0 comments on commit ee16772

Please sign in to comment.