Skip to content

Commit

Permalink
Merge pull request #13536 from niden/T13468-inconsistent-naming-conve…
Browse files Browse the repository at this point in the history
…ntion-in-dispatcher-2

[#13468] - Added `getHandlerSuffix()`, `setHandlerSuffix()` in Dispatcher
  • Loading branch information
niden authored Oct 18, 2018
2 parents 43e6a58 + 9a70133 commit 9390b61
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Added `Phalcon\Mvc\Router\RouteInterface::convert` so that calling `Phalcon\Mvc\Router\Group::add` will return an instance that has `convert` method [#13380](https://github.com/phalcon/cphalcon/issues/13380)
- Added `Phalcon\Mvc\ModelInterface::getModelsMetaData` [#13070](https://github.com/phalcon/cphalcon/issues/13402)
- Added `paginate()` method as a proxy of `getPaginate`. Added `previous` in the paginator object same as `before`. After 4.0 is released we will deprecate `getPaginate()`, `before` and `total_items` [#13492](https://github.com/phalcon/cphalcon/issues/13492)
- Added `getHandlerSuffix()`, `setHandlerSuffix()` in Dispatcher, `getTaskSuffix()`, `setTaskSuffix()` in the CLI Dispatcher [#13468](https://github.com/phalcon/cphalcon/issues/13468)
- Added ability to set a custom template for the Flash Messenger. [#13445](https://github.com/phalcon/cphalcon/issues/13445)

## Changed
Expand Down
16 changes: 16 additions & 0 deletions phalcon/cli/dispatcher.zep
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ class Dispatcher extends CliDispatcher implements DispatcherInterface
let this->_handlerName = taskName;
}

/**
* Sets the default task suffix
*/
public function setTaskSuffix(string taskSuffix)
{
let this->_handlerSuffix = taskSuffix;
}

/**
* Gets last dispatched task name
*/
Expand All @@ -90,6 +98,14 @@ class Dispatcher extends CliDispatcher implements DispatcherInterface
return this->_handlerName;
}

/**
* Gets the default task suffix
*/
public function getTaskSuffix() -> string
{
return this->_handlerSuffix;
}

/**
* Throws an internal exception
*/
Expand Down
5 changes: 5 additions & 0 deletions phalcon/cli/dispatcherinterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ interface DispatcherInterface extends DispatcherInterfaceBase
*/
public function getTaskName() -> string;

/**
* Gets default task suffix
*/
public function getTaskSuffix() -> string;

/**
* Returns the latest dispatched controller
*/
Expand Down
16 changes: 16 additions & 0 deletions phalcon/dispatcher.zep
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ abstract class Dispatcher implements DispatcherInterface, InjectionAwareInterfac
return this->_returnedValue;
}

/**
* Sets the default suffix for the handler
*/
public function setHandlerSuffix(string handlerSuffix) -> void
{
let this->_handlerSuffix = handlerSuffix;
}

/**
* Enable model binding during dispatch
*
Expand Down Expand Up @@ -351,6 +359,14 @@ abstract class Dispatcher implements DispatcherInterface, InjectionAwareInterfac
return this;
}

/**
* Gets the default handler suffix
*/
public function getHandlerSuffix() -> string
{
return this->_handlerSuffix;
}

/**
* Gets model binder
*/
Expand Down
10 changes: 10 additions & 0 deletions phalcon/dispatcherinterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,21 @@ interface DispatcherInterface
*/
public function getActionSuffix() -> string;

/**
* Gets the default handler suffix
*/
public function getHandlerSuffix() -> string;

/**
* Sets the default namespace
*/
public function setDefaultNamespace(string defaultNamespace);

/**
* Sets the default suffix for the handler
*/
public function setHandlerSuffix(string handlerSuffix);

/**
* Sets the default action name
*/
Expand Down

0 comments on commit 9390b61

Please sign in to comment.