Can be done after issue #4720 is resolved and merged
For certain things, like Permission control or sometimes method, it'd be great, if we could just use decorators and certain functions would get called everywhere these decorators are present, this would help in plugging in functionality very simple.
For example, I've a controller:
class User extends CI_Controller{
/**
* @_permission user.create
*/
public function create($user){
//just create the user
}
/**
* @_permission user.stuff,user.otherstuff
* @_method GET,POST
*/
public function stuff($user){
// do stuff
}
}
Now it'd be awesome, user could just define a function inside a directory, such as application/decorators/permission.php and application/decorators/method.php and those would be called.
I'm not sure if using those are bad practices, and I've done some research, and everyone seem to be loving decorators, here's a proposal on introducing them. I can send PR myself if required, please present your view on weather it's good or bad to have them.
No.
@narfbg Just no? A little more explanation would have been nicer.
It probably would have been nicer, indeed. But after handling thousands of issues, I no longer have any desire to provide explanations for everything.
Sorry.
@narfbg
https://docs.phalconphp.com/en/latest/reference/annotations.html phalcon guys seem to like annotations, I'm not sure why CodeIgniter does not, well, I'm moving to phalcon right away. :stuck_out_tongue:
Good for you.