Skip to content

Commit

Permalink
Merge pull request #181 from joaoinacio/EZP-24897_preview
Browse files Browse the repository at this point in the history
Fix EZP-24897: Error on blog post first draft preview
  • Loading branch information
andrerom committed Oct 6, 2015
2 parents 17869bb + e08b409 commit 3f37dde
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Controller/DemoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,20 @@ public function listBlogPostsAction( $locationId )
*/
public function showBlogPostAction( $locationId, $viewType, $layout = false, array $params = array() )
{
// We need the author, whatever the view type is.
$repository = $this->getRepository();
$location = $repository->getLocationService()->loadLocation( $locationId );
if ( isset( $params['location'] ) && $params['location'] instanceof Location )
{
$location = $params['location'];
}
else if ( is_numeric( $locationId ) )
{
$location = $repository->getLocationService()->loadLocation( $locationId );
}
else
{
throw new NotFoundHttpException( "Unknown location '$locationId' cannot be displayed." );
}
// We need the author, whatever the view type is.
$author = $repository->getUserService()->loadUser( $location->getContentInfo()->ownerId );

// TODO once the keyword service is available, load the number of keyword for each keyword
Expand Down

0 comments on commit 3f37dde

Please sign in to comment.