Skip to content

Commit 9390b61

Browse files
authored
Merge pull request #13536 from niden/T13468-inconsistent-naming-convention-in-dispatcher-2
[#13468] - Added `getHandlerSuffix()`, `setHandlerSuffix()` in Dispatcher
2 parents 43e6a58 + 9a70133 commit 9390b61

5 files changed

+48
-0
lines changed

CHANGELOG-4.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 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)
66
- Added `Phalcon\Mvc\ModelInterface::getModelsMetaData` [#13070](https://github.com/phalcon/cphalcon/issues/13402)
77
- 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)
8+
- Added `getHandlerSuffix()`, `setHandlerSuffix()` in Dispatcher, `getTaskSuffix()`, `setTaskSuffix()` in the CLI Dispatcher [#13468](https://github.com/phalcon/cphalcon/issues/13468)
89
- Added ability to set a custom template for the Flash Messenger. [#13445](https://github.com/phalcon/cphalcon/issues/13445)
910

1011
## Changed

phalcon/cli/dispatcher.zep

+16
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ class Dispatcher extends CliDispatcher implements DispatcherInterface
8282
let this->_handlerName = taskName;
8383
}
8484

85+
/**
86+
* Sets the default task suffix
87+
*/
88+
public function setTaskSuffix(string taskSuffix)
89+
{
90+
let this->_handlerSuffix = taskSuffix;
91+
}
92+
8593
/**
8694
* Gets last dispatched task name
8795
*/
@@ -90,6 +98,14 @@ class Dispatcher extends CliDispatcher implements DispatcherInterface
9098
return this->_handlerName;
9199
}
92100

101+
/**
102+
* Gets the default task suffix
103+
*/
104+
public function getTaskSuffix() -> string
105+
{
106+
return this->_handlerSuffix;
107+
}
108+
93109
/**
94110
* Throws an internal exception
95111
*/

phalcon/cli/dispatcherinterface.zep

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ interface DispatcherInterface extends DispatcherInterfaceBase
4949
*/
5050
public function getTaskName() -> string;
5151

52+
/**
53+
* Gets default task suffix
54+
*/
55+
public function getTaskSuffix() -> string;
56+
5257
/**
5358
* Returns the latest dispatched controller
5459
*/

phalcon/dispatcher.zep

+16
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ abstract class Dispatcher implements DispatcherInterface, InjectionAwareInterfac
320320
return this->_returnedValue;
321321
}
322322

323+
/**
324+
* Sets the default suffix for the handler
325+
*/
326+
public function setHandlerSuffix(string handlerSuffix) -> void
327+
{
328+
let this->_handlerSuffix = handlerSuffix;
329+
}
330+
323331
/**
324332
* Enable model binding during dispatch
325333
*
@@ -351,6 +359,14 @@ abstract class Dispatcher implements DispatcherInterface, InjectionAwareInterfac
351359
return this;
352360
}
353361

362+
/**
363+
* Gets the default handler suffix
364+
*/
365+
public function getHandlerSuffix() -> string
366+
{
367+
return this->_handlerSuffix;
368+
}
369+
354370
/**
355371
* Gets model binder
356372
*/

phalcon/dispatcherinterface.zep

+10
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,21 @@ interface DispatcherInterface
3737
*/
3838
public function getActionSuffix() -> string;
3939

40+
/**
41+
* Gets the default handler suffix
42+
*/
43+
public function getHandlerSuffix() -> string;
44+
4045
/**
4146
* Sets the default namespace
4247
*/
4348
public function setDefaultNamespace(string defaultNamespace);
4449

50+
/**
51+
* Sets the default suffix for the handler
52+
*/
53+
public function setHandlerSuffix(string handlerSuffix);
54+
4555
/**
4656
* Sets the default action name
4757
*/

0 commit comments

Comments
 (0)