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.
controller:
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:
class TestForm extends CFormModel { public $firstName; public $lastName; public function rules() { return array( array('firstName, lastName', 'required'), ); } }
Be the first person to leave a comment
Please login to leave your comment.