Giix — Gii Extended

Changed your entries above for a numbered list.

Comments below.

  1. The way it is currently is simpler. I don’t believe that adding a ‘related items’ heading is user-friendly (to the visitor of the generated page).

  2. and 3. Action and attribute label naming are already on the roadmap! :) You can open an issue at Google Code and attach your code if you want. Thank you!

  3. Selection of fields is also in the roadmap. Again, you can open an issue and send your code.

  4. I didn’t understand that. Could you please elaborate and, maybe, show some code?

All generated code must stay on the base model.

When you need, you can just override the method.

Thank you for your suggestions!

I’m glad you like giix.

  1. The labels will be changed forever. Therefore questioned whether the best place for attributeLabels() is the base file.

GiixModelCode.php




(...)

public function generateRules($table)

{

	foreach($this->getEditableColumns($table->columns) as $column)

	{

		(...)

	}

}

(...)

public function getEditableColumns($columns)

{

		$colunas = array();


		foreach($columns as $columName => $column)

		{

			if(substr($column->name, 0,4) != "log_")

                            $colunas[$columName] = $column;

		}

		return $colunas;

	}

(...)



Example of item 5:

File BaseBanco.php




(...)


	public function search($options = array(), $options_criteria = array()) {

		$criteria = new CDbCriteria;


		$criteria->compare('cd_banco', $this->cd_banco);

		$criteria->compare('nm_banco', $this->nm_banco, true);

		$criteria->compare('nm_rsmd_banco', $this->nm_rsmd_banco, true);

		$criteria->compare('dc_cod_banco', $this->dc_cod_banco, true);


                $criteria->mergeWith($options_criteria);


		return new CActiveDataProvider(

                    get_class($this),

                    array_merge(

                        array(

                            'criteria' => $criteria,

                            'sort'=>array(

                                    'defaultOrder'=>'nm_banco',

                            ),

                            'pagination'=>array(

                                    'pageSize'=> Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']),

                            ),

                        ),

                        $options

                    )

                );

	}

(...)



  1. I was about to suggest that the code could be generated in the model file and base model file. Why?

Imho, as @Athos said, attributeLabels must be edited, so, whenever you generate a new model, you must enter the base file, copy the attributeLabels section code and past into model file.

Well, if i always will enter base file to copy code and will always have the code inside the two files, why not generating directly? In a two or three model app it would be useless, but in a huge app that has dozens of models, it would be very usefull and time saving.

by the way, thanks for Giix!

regards!

Am I misunderstanding something with this?

Does GiixCrud Generator also not work on tables with composite primary keys?

I still get the error


Table '' has a composite primary key which is not supported by crud generator.

@enfield, giix doesn’t have yet full support to tables with composite PK.

The giix Crud Generator doesn’t support composite PK yet.

Full support, including CRUD generation, for composite PK is on the roadmap.

Hi:

I just installed giix-1.6 following the instructions (giix-core and giix-components directly under the extensions directory) and when I tried to create a model encountered a problem:

I verified the file/directory permissions (under Linux) and they seem fine. Any ideas? Thanks.

mental, thanks for the response. I have been searching for a solution to primary composite keys and that is when I came across giix. Is the support for primary composite keys as stated in the info in regards to AR then?

Also do you know of a solution to working with primary composite keys without writing out everything longhand?

giix is a great extension up to this point and with the info given for future releases it will only become that much better. Thanks.

No. The current partial support is documented on each method. I suggest you to read the documentation for each method that you intend to use to know if and how it supports composite PK.

No, since I didn’t need composite PK yet.

But I keep my suggestion to read and learn about giix. Where there’s no support, you can add.

Thank you very much :)

Please check the step 3 of the installation file.

If it doesn’t help, I’ll need more information to be able to help you.

That was it, I was missing the ‘.*’. It works now. Thanks!

Apparently “there’s no such thing as a stupid question” so here goes.

Have been playing with giix and there’s lots to love.

Can’t though for the life of me figure out why the forms go to the trouble of generating a checkboxlist or dropdownlist for related fields. Could someone please explain why these are considered appropriate input fields or give me a use case for what I’m supposed to do with them, because I’m obviously missing something.

Thank you!

Because they are has-many or many-many relations. Example: if your’re looking at modelA create form and it has a has-many relation to modelB, you will have the opportunity to select more than one modelB.

And be welcome to the forum!

Hi mongoose76, sorry for the late reply. giix may have support to Athos’ suggestion in the future. Stay tuned! :)

Hi Kabinenkoffer,

No, giix has its own means of handling related data and there will be no effort to make it compatible with the Relation widget.

Is this fixed in the newest version?

Sorry for the late reply.

Thanks for the welcome!

I understand that for instance Customer can have many Orders.

So, say I’ve created a few Customers - and have attached a few Orders for each.

Now I go to create a new Customer - my giix form appends a checkboxlist of existing Customers’ Orders.

I am still really missing the point of why I would want to select any existing Customers’ Orders while I’m creating a new Customer…

You have clearly gone to some trouble to provide this functionality, so there obviously is a point - and I’d hate to miss it! :slight_smile:

So If you could spell out the simplest practical example I would be very grateful.

This may help you: http://www.yiiframework.com/doc/guide/1.1/en/database.arr#relational-query-with-through.

A pivot table is a table that maintains the relationship between two other tables that have a many-many relation.

In your case, the table "developpeur" is a pivot table.

You should not change the generated base model file, otherwise giix will override it when regenerating the model. This may not be your case, but that’s the reason for separating the files.

The same applies to the model file: giix should not write to it, so it does not override your code.

This behavior won’t be changed.

Thank you :)

Thanks again :)

Your suggestions are on the roadmap and should be integrated into giix.

Please see my answer to Athos in the post above.

Well, it’s up to you to provide meaning to the generated code.

It is just generic code. You still need to code the business rules.

giix 1.7 is here!

All known bugs were fixed:

  • Added proper support to ‘uncheckValue’.

  • Now the generated model::search method uses the current instance of the model and allows the use of custom criteria.

The code from Yii was updated to the version 1.1.7 (r3135) of the framework.

More to come :)