-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PreSave and PostSave events (#78)
- Loading branch information
1 parent
c376c5f
commit 0d5bea8
Showing
6 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Sherlockode\ConfigurationBundle\Event; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class PostSaveEvent | ||
{ | ||
use ResponseEventTrait; | ||
use RequestEventTrait; | ||
|
||
/** | ||
* @param Request $request | ||
*/ | ||
public function __construct(Request $request) | ||
{ | ||
$this->request = $request; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Sherlockode\ConfigurationBundle\Event; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class PreSaveEvent | ||
{ | ||
use ResponseEventTrait; | ||
use RequestEventTrait; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $parameters; | ||
|
||
/** | ||
* @param array $parameters | ||
*/ | ||
public function __construct(Request $request, $parameters) | ||
{ | ||
$this->request = $request; | ||
$this->parameters = $parameters; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getParameters() | ||
{ | ||
return $this->parameters; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Sherlockode\ConfigurationBundle\Event; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
trait RequestEventTrait | ||
{ | ||
/** | ||
* @var Request | ||
*/ | ||
private $request; | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function getRequest() | ||
{ | ||
return $this->request; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Sherlockode\ConfigurationBundle\Event; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
trait ResponseEventTrait | ||
{ | ||
/** | ||
* @var Response | ||
*/ | ||
private $response; | ||
|
||
/** | ||
* @return Response | ||
*/ | ||
public function getResponse() | ||
{ | ||
return $this->response; | ||
} | ||
|
||
/** | ||
* @param Response $response | ||
* | ||
* @return $this | ||
*/ | ||
public function setResponse(Response $response) | ||
{ | ||
$this->response = $response; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters