Yii Framework Forum: [EXTENSION] CrudActions - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] CrudActions Generic create, update, view, delete, index (list) actions

#1 User is offline   intel352 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 196
  • Joined: 05-February 10
  • Location:Southport, NC

Posted 01 November 2011 - 03:45 PM

CrudActions is a Yii extension, which provides generic CRUD action classes, including: create, view, update, delete, index (list) actions.

This extension intends to provide an alternative to generating repetitive code using Gii. By the nature of the actions existing as action classes, you can pick & choose which actions you will use.

With this extension, you are able to override the model and view used per action, and even declare action event handlers for onBeforeSave, onAfterSave, onBeforeDelete, onAfterDelete, onBeforeRender, onAfterRender, etc. This way, if you need to customize some of the action logic without needing to duplicate the action's logic, you can do so.

View the repository page: CrudActions repo at BitBucket

View the extension page (and download): CrudActions extension page in YiiFramework.com

Very basic example usage:

class TestFormController extends Controller {
    public function actions() {
        return array(
            # PHP convention for referencing namespaces in double-quoted strings, is to double-backslash
            # This convention is for your safety (for programmers that double-quote their strings)
            # See: http://www.php.net/m...paces.faq.quote
            'create' => '\ext\crudactions\Create',
            'update' => '\ext\crudactions\Update',
            'delete' => '\ext\crudactions\Delete',
            'index' => array(
                'class' => '\ext\crudactions\Index',
                # Specifying an event handler for onBeforeRender (optional)
                'onBeforeRender' => function(CEvent $event){$event->sender->controller->addSearchTab('left');},
                # Specifying a custom view file (optional)
                'viewFile' => 'customIndex',
            'view' => '\ext\crudactions\View',

class TestForm extends CFormModel {
    public $firstName;
    public $lastName;
    public function rules() {
        return array(
            array('firstName, lastName', 'required'),

Need live Yii support? - Join the #yii IRC channel on Freenode!

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users