mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 07:33:43 +08:00
Provide empty run() method.
This allows me to override the handle() method in subclasses (where I need access to the request object) without having to overwrite run(), too. The class is still abstract.
This commit is contained in:
parent
35c9ab9f23
commit
1619f84bc8
@ -13,8 +13,6 @@ use Response;
|
|||||||
|
|
||||||
abstract class BaseAction extends Action
|
abstract class BaseAction extends Action
|
||||||
{
|
{
|
||||||
abstract protected function run(ApiParams $params);
|
|
||||||
|
|
||||||
public function __construct(Actor $actor, Dispatcher $bus)
|
public function __construct(Actor $actor, Dispatcher $bus)
|
||||||
{
|
{
|
||||||
$this->actor = $actor;
|
$this->actor = $actor;
|
||||||
@ -40,6 +38,15 @@ abstract class BaseAction extends Action
|
|||||||
return $this->run($params);
|
return $this->run($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ApiParams $params
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function run(ApiParams $params)
|
||||||
|
{
|
||||||
|
// Should be implemented by subclasses
|
||||||
|
}
|
||||||
|
|
||||||
public function hydrate($object, $params)
|
public function hydrate($object, $params)
|
||||||
{
|
{
|
||||||
foreach ($params as $k => $v) {
|
foreach ($params as $k => $v) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user