xcruder general table manager module handling relations

  1. Requirements
  2. History
  3. Using the module
  4. Using the demo (xcruder_demo)
  5. Limitations
  6. Resources

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

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:

select a model

View the related records clicking the View icon of a row:

view the relations

Create a new related record:

create related record

Select an valid foreign key by the picker view, in either update or create modes:

update related record

5 0
8 followers
1 949 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Database
Developed by: nlac
Created on: Jun 13, 2011
Last updated: 12 years ago

Downloads

show all

Related Extensions