Codeigniter: Introduce decorators in PHPDoc

Created on 22 Jul 2016  路  5Comments  路  Source: bcit-ci/CodeIgniter

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.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

al-ramadhan picture al-ramadhan  路  6Comments

huehnerhose picture huehnerhose  路  6Comments

casa10 picture casa10  路  5Comments

rmdhfz picture rmdhfz  路  3Comments

rjdjohnston picture rjdjohnston  路  4Comments