Phalcon PHP Upgrade
My experience upgrading a Phalcon PHP 1.3.5 application to 3.4.2
Post by Pedro Resende on the 4 of January of 2019 at 19:00
In the last couple of weeks I've been working on the upgrade of framework Phalcon on the existing platform from version 1.3.5 to 3.4.2.
Whenever you thing about an upgrade jumping to a major version of an existing framework it's usually a nightmare, due to the code deprecations and BC (Binary Compatibility) breaks.
However, I must admit I was quite surprised with the changes needed, tipicaly it basicly resumed to the following:
public function setDI($dependencyInjector) -> public function setDI(\Phalcon\DiInterface $dependencyInjector) On the classes extending \Phalcon\Mvc\Controller instead of being able to use $this->di, it changed to $this->_dependencyInjector or $this->getDi(). In my opinion the usage of $this->getDi() is recommended. public function format ($message, $type, $timestamp, $context) -> public function format ($message, $type, $timestamp, $context = null) protected function _engineRender ($engines, $path, $silence, $mustClean, $cache) -> protected function _engineRender($engines, $viewPath, $silence, $mustClean, \Phalcon\Cache\BackendInterface $cache = NULL) public function setVars ($vars, $merge=null) -> public function setVars(array $params, $merge = NULL) public function validate($validator, $attribute) -> public function validate(\Phalcon\Validation $validation, $attribute) isSetOption() -> hasOption()
And the most anoying one if the validation limit. In version 1.3.x we could use `max` => null and it would consider the value unlimited, however in 3.4.2 you need to specify a value...
That's it, has you can see there aren't a lot of changes needed