hi all! i want to rewrite functions in Phalcon\Session\Adapter\Redis. so can i do it??? ex: rewrite: public function write(), public function read()... thanks so!
Sure, create your own class:
class MyRedisAdapter extends \Phalcon\Session\Adapter\Redis { public function write() { // ... } public function read() { // ... } }
Then register this as your session adapter in services:
$di->setShared('session', function() { $session = new MyRedisAdapter(); return $session; });
Yes. Just create your class and extend Phalcon\Session\Adapter\Redis
thank you! usefull
Sure, create your own class: class MyRedisAdapter extends \Phalcon\Session\Adapter\Redis { public function write() { // ... } public function read() { // ... } } Then register this as your session adapter in services: $di->setShared('session', function() { $session = new MyRedisAdapter(); return $session; });
sorry, can you tell me where is the class MyRedisAdapter place in project??? thanks
Depends on your your project layout, you have to register it with the class loader: https://docs.phalcon.io/en/latest/reference/loader.html
my file structure as example of phalcon and what i should use???
Registering Directories ,Registering Classes, Registering Namespaces! thank you for help!