Yii Framework Forum: Giix — Gii Extended - Yii Framework Forum

Jump to content

  • (14 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Giix — Gii Extended a code generator for Yii PHP framework (scaffolding/code generation) Rate Topic: ***** 4 Votes

#61 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 12 May 2011 - 03:04 PM

View PostAthos, on 12 May 2011 - 02:46 PM, said:

1. In the page of view's action, before listing the relations, with a tag <h2> highlight that these are dependent or related records.
2. On the generation of CRUD, include two more fields. To enter a screen name in my language and the other for the plural name. You know in any language other than English you can not retrieve the correct name of the nomenclature of the database.
3. For the same reasons, can not catch the names of the attributes directly from the data model. Then the method attributeLabes should not stay on the base file, since it must necessarily be changed. If he remains at the base, can not be the goal of these files remain intact.
4. Many databases have fields in each table to log user actions. I then created a method (getEditableColumns) to always ignore them in loops over the columns of the table, not to create the inputs and validations on the form, for example.
5. At least for me it was very important to change the method model->search() to do a merge with other default options passed as parameter.


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!

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

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

View PostAthos, on 12 May 2011 - 02:46 PM, said:

3. [...] Then the method attributeLabes should not stay on the base file, since it must necessarily be changed. If he remains at the base, can not be the goal of these files remain intact.


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.
0

#62 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 87
  • Joined: 07-January 11

Posted 12 May 2011 - 03:26 PM

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

4)
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
                    )
                );
	}
(...)

Thanks Google Translator to helping me write the posts :)
0

#63 User is offline   Junior - df9 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 415
  • Joined: 24-May 09
  • Location:Brazil

Posted 13 May 2011 - 06:10 AM

3) 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!
______________________________________
Junior
df9.com.br
Linux Registered User #364954
GNU/Linux: together we're ready!
0

#64 User is offline   enfield 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 288
  • Joined: 12-January 11

Posted 23 May 2011 - 12:51 AM

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.

0

#65 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 23 May 2011 - 03:23 AM

View Postenfield, on 23 May 2011 - 12:51 AM, said:

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.
0

#66 User is offline   JFReyes 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 477
  • Joined: 28-October 09
  • Location:Puerto Rico

Posted 23 May 2011 - 09:23 AM

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:

Quote

Class 'GxActiveRecord' does not exist or has syntax error.


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

#67 User is offline   enfield 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 288
  • Joined: 12-January 11

Posted 23 May 2011 - 01:52 PM

View Postmentel, on 23 May 2011 - 03:23 AM, said:

@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.


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.
0

#68 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 23 May 2011 - 07:13 PM

View Postenfield, on 23 May 2011 - 01:52 PM, said:

Is the support for primary composite keys as stated in the info in regards to AR then?


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.

View Postenfield, on 23 May 2011 - 01:52 PM, said:

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


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.

View Postenfield, on 23 May 2011 - 01:52 PM, said:

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.


Thank you very much :)
0

#69 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 23 May 2011 - 07:17 PM

View PostJFReyes, on 23 May 2011 - 09:23 AM, said:

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


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.
0

#70 User is offline   JFReyes 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 477
  • Joined: 28-October 09
  • Location:Puerto Rico

Posted 24 May 2011 - 01:49 PM

View Postmentel, on 23 May 2011 - 07:17 PM, said:

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!
José
0

#71 User is offline   dave mc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-January 11

Posted 30 May 2011 - 04:10 PM

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.
0

#72 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 30 May 2011 - 04:17 PM

View Postdave mc, on 30 May 2011 - 04:10 PM, said:

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


Thank you!

View Postdave mc, on 30 May 2011 - 04:10 PM, said:

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.


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!
0

#73 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 31 May 2011 - 12:57 PM

View Postmongoose76, on 03 February 2011 - 11:47 AM, said:

Aha. Well, seems like a workable solution, so there u go, people have two ways of solving the pluralize problem and maybe more.


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

#74 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 31 May 2011 - 12:59 PM

Hi Kabinenkoffer,

View PostKabinenkoffer, on 13 February 2011 - 06:18 AM, said:

Maybe there is a way to include the relation widget or to make it compatible?


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

View PostKabinenkoffer, on 13 February 2011 - 06:18 AM, said:

I also have a Problem with the create part. the relational data is not updated, yii stays on the create form pafe with no message and no error. the update function is working. any ideas?


Is this fixed in the newest version?

Sorry for the late reply.
0

#75 User is offline   dave mc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-January 11

Posted 31 May 2011 - 02:36 PM

View Postmentel, on 30 May 2011 - 04:17 PM, said:

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!

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! :-)

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

#76 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 31 May 2011 - 02:40 PM

View PostElfange, on 20 April 2011 - 07:35 AM, said:

I want to create on the user form an option to activate or not the email notification on linked project.

Btw I didn't understood your method 'pivot', could it help me ?


This may help you: http://www.yiiframew...ry-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.
0

#77 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 31 May 2011 - 03:15 PM

View PostAthos, on 12 May 2011 - 03:26 PM, said:

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


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.

View PostAthos, on 12 May 2011 - 03:26 PM, said:

4)
GiixModelCode.php


Thank you :)

View PostAthos, on 12 May 2011 - 03:26 PM, said:

Example of item 5:

File BaseBanco.php


Thanks again :)

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

#78 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 31 May 2011 - 03:18 PM

View Postscoob.junior, on 13 May 2011 - 06:10 AM, said:

3) 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!


Please see my answer to Athos in the post above.
0

#79 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 31 May 2011 - 03:20 PM

View Postdave mc, on 31 May 2011 - 02:36 PM, said:

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! :-)

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


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.
0

#80 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 664
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 04 June 2011 - 09:49 AM

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 :)
1

Share this topic:


  • (14 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users