1. Yuri Karasev
  2. CrudActions

Overview

HTTPS SSH

CrudActions - CRUD actions extension for Yii

CrudActions is a Yii extension, which provides generic CRUD action classes.

Requirements

  • Yii 1.1+ (Yii 1.1.8+ recommended, lower releases should be compatible, but are untested)
  • PHP 5.3+ (CrudActions library is namespaced, which is a PHP 5.3 feature)

Installation

Clone this repository to fetch the latest version of this client

cd myYiiApp\protected\extensions\
hg clone https://bitbucket.org/intel352/crudactions

Quick start

controller:

<?php

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/manual/en/language.namespaces.faq.php#language.namespaces.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',
        );
    }
}

model:

<?php

class TestForm extends CFormModel {

    public $firstName;
    public $lastName;

    public function rules() {
        return array(
            array('firstName, lastName', 'required'),
        );
    }
}