Skip to content

Commit

Permalink
EZP-29979: As a developer I would like to use getLocation method on C…
Browse files Browse the repository at this point in the history
…ontentCreateSuccessView and ContentEditSuccessView (#270)

* EZP-29979: As a developer I would like to use getLocation method on ContentCreateSuccessView and ContentEditSuccessView

* Removed null from setLocation

* Update lib/Content/View/ContentCreateSuccessView.php

Co-Authored-By: kmadejski <kmadejski@live.com>

* Update lib/Content/View/ContentEditSuccessView.php

Co-Authored-By: kmadejski <kmadejski@live.com>

* Recovered possiblity to pass null to setLocation method
  • Loading branch information
kmadejski authored and Łukasz Serwatka committed Mar 4, 2019
1 parent 60d12a8 commit 89301fc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/Content/View/Builder/ContentCreateViewBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ public function buildView(array $parameters)
);

if ($response = $this->contentActionDispatcher->getResponse()) {
return new ContentCreateSuccessView($response);
$view = new ContentCreateSuccessView($response);
$view->setLocation($location);

return $view;
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/Content/View/Builder/ContentEditViewBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ public function buildView(array $parameters)
);

if ($response = $this->contentActionDispatcher->getResponse()) {
return new ContentEditSuccessView($response);
$view = new ContentEditSuccessView($response);
$view->setLocation($location);

return $view;
}
}

Expand Down
23 changes: 22 additions & 1 deletion lib/Content/View/ContentCreateSuccessView.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@

namespace EzSystems\RepositoryForms\Content\View;

use eZ\Publish\API\Repository\Values\Content\Location;
use eZ\Publish\Core\MVC\Symfony\View\BaseView;
use eZ\Publish\Core\MVC\Symfony\View\LocationValueView;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Controller\ControllerReference;

class ContentCreateSuccessView extends BaseView
class ContentCreateSuccessView extends BaseView implements LocationValueView
{
/** @var \eZ\Publish\API\Repository\Values\Content\Location|null */
private $location;

/**
* @param \Symfony\Component\HttpFoundation\Response $response
*
Expand All @@ -25,4 +30,20 @@ public function __construct(Response $response)
$this->setResponse($response);
$this->setControllerReference(new ControllerReference('ez_content_edit:createWithoutDraftSuccessAction'));
}

/**
* @param \eZ\Publish\API\Repository\Values\Content\Location|null $location
*/
public function setLocation(?Location $location): void
{
$this->location = $location;
}

/**
* @return \eZ\Publish\API\Repository\Values\Content\Location|null
*/
public function getLocation(): ?Location
{
return $this->location;
}
}
23 changes: 22 additions & 1 deletion lib/Content/View/ContentEditSuccessView.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@

namespace EzSystems\RepositoryForms\Content\View;

use eZ\Publish\API\Repository\Values\Content\Location;
use eZ\Publish\Core\MVC\Symfony\View\BaseView;
use eZ\Publish\Core\MVC\Symfony\View\LocationValueView;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Controller\ControllerReference;

class ContentEditSuccessView extends BaseView
class ContentEditSuccessView extends BaseView implements LocationValueView
{
/** @var \eZ\Publish\API\Repository\Values\Content\Location|null */
private $location;

/**
* @param \Symfony\Component\HttpFoundation\Response $response
*
Expand All @@ -25,4 +30,20 @@ public function __construct(Response $response)
$this->setResponse($response);
$this->setControllerReference(new ControllerReference('ez_content_edit:editVersionDraftSuccessAction'));
}

/**
* @param \eZ\Publish\API\Repository\Values\Content\Location|null $location
*/
public function setLocation(?Location $location): void
{
$this->location = $location;
}

/**
* @return \eZ\Publish\API\Repository\Values\Content\Location|null
*/
public function getLocation(): ?Location
{
return $this->location;
}
}

0 comments on commit 89301fc

Please sign in to comment.