xcruder is a general table manager module being able to manage relations. Only the model class files have to be created, not any CRUD pages.
Find the module in the /protected/modules directory of the demo app.
Requirements ¶
- extension advancedrelationsbehavior (great extension from alexjay) to be installed
- extension nlsclientscript to be installed
History ¶
- 1.2 (current)
- adopted to Yii v1.18
- 1.1
- cleaned up code, demo table structures
- updated the used extension to the latest
- more column types in the demo db (added date, enum)
- added more validation rules to the demo models
- 1.0
- base version
Using the module ¶
In your app,
- Register advancedrelationsbehavior and nlsclientscript in /protected/config/main.php, see their tutorials and the demo app how to do that
- Create the models for the tables to be managed, using some model generator - it can be the default gii one or giix. Don't forget to define the relations properly for the models
- In all model classes to be managed, define this method (or inherit all models from a base model class having this method):
public function behaviors(){
return array(
'AdvancedRelationsBehavior' => array(
'class' => 'application.extensions.advancedrelationsbehavior.AdvancedRelationsBehavior',//path to the extension
'autoUpdate' => false,
'autoDelete' => true,
'relations' => null
)
);
}
- In /protected/config/main.php, register the models you want to manage:
'modules'=>array(
...
'xcruder'=>array(
'c_models' => array(
'application.models.Post',
'application.models.Tag',
'application.models.Comment',
'application.models.Blogger',
...
)
)
...
)
- In /protected/config/main.php, register prado view renderer (i use prado format on some places):
'components'=>array(
...
'viewRenderer'=>array(
'class'=>'CPradoViewRenderer'
)
...
)
- In /protected/config/main.php, extend the params section by these values
'params'=>array(
...
'dev' => 1,//0|1, developement stage
'pageSize' => 6//int, pagination size
)
Using the demo (xcruder_demo) ¶
- install the script xcruder_demo/protected/data/schema.mysql.sql into your database
- set your database properly in /protected/config/main.php
- in /index.php, set the $yii variable to have the proper framework directory path
Login as admin/admin and go to the xcruder menu item.
Limitations ¶
- still can't handle 'set' an 'blob' fields
- many others:)
Resources ¶
See some screenshots here
Select a model first in the combo:
View the related records clicking the View icon of a row:
Create a new related record:
Select an valid foreign key by the picker view, in either update or create modes:
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.