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

Jump to content

  • (14 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • 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

#81 User is offline   bglee 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 152
  • Joined: 21-November 10
  • Location:Oak Park, IL

Posted 04 June 2011 - 01:11 PM

Quote

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.


mentel, the behavior he's describing makes sense in a Many-to-Many relationship, but not in a One-To-Many relationship, the kind you would expect between Customer and Orders. Does giix behave the same for Many-To-Many and One-To-Many relationships?

I recently came across your extension and thought I'd see what it provided above and beyond gii. I'll be playing with it soon in a test environment. Thanks!
It takes 2 points to draw a straight line, but at least 3 to draw a conclusion.
0

#82 User is offline   Rodrigo Coelho 

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

Posted 04 June 2011 - 01:21 PM

The generated code, in this case, is more like an example.
The behavior will be defined by your own code.
0

#83 User is offline   Waws 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 27-March 11

Posted 09 June 2011 - 09:01 AM

Giix is awesome mentel, great job!
I've been working for several days on implementing my own many-many CRUD without success. Finished it in 30 mins with help of Giix. :)

Looking forward to see ticket 7 for even more awesomeness.
I think it should be added to Yii and replace Gii, I bet many people don't know about extensions and therefore misses this one.

Keep the good work up.
0

#84 User is offline   Waws 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 27-March 11

Posted 16 June 2011 - 02:34 AM

I think I've found a bug in how Giix displays boolean values in the admin CGridView view.
The affected columns in my database have the type tinyint(1) and ofcourse have the values 0 or 1.
But despite if the value is 0 or 1 it is shown as 'Yes' in the table. The dropdown filtering works correctly, filtering all 0 values when 'No' is selected, and the other way around.

A column entry in the CGridView widget in admin.php looks like
// ...
array(
	'name' => 'isDefault',
	'value' => '($data->isDefault === 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',
	'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
),
// ...


I solved it by
// ...
array(
	'name' => 'isDefault',
	//'value' => '($data->isDefault === 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',
	'type' => 'boolean',
	'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
),
// ...



Feels strange if this is a bug that have slipped under everyones radar, maybe I am doing something wrong?
I am using Yii 1.1.7 by the way.
0

#85 User is offline   foghorn leghorn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 16-June 11

Posted 16 June 2011 - 10:08 AM

Some ideas for the crud part that would be useful for me and aren't in the issues already at google code:
-When creating a new entry and having to select something from another table, the ability to quickly create a new entry in the other (related) table which is then automatically selected in the first entry form. Possibly cascaded.

-I find the representingColumn() function quite restricting. So far I have been unable to insert arbitrary text or columns from another related table.

-I don't know whether it's a problem with me, my database or something else, but I can't seem to set a foreign key back to null. When you have a dropdownlist you always have to select something.

I don't know whether these ideas are 'worthy' of being added to the issues at google code, but I wouldn't mind adding them if they are.
0

#86 User is offline   Rodrigo Coelho 

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

Posted 16 June 2011 - 05:42 PM

View Postmongoose76, on 03 February 2011 - 04:17 AM, said:

My database is in Romanian as well so the plurals of the models sound ridiculous so I have to always change them after I re-generate with giix CRUD. I re-generate a lot since I am playing around with the templates. Now, the solution I found to not change manually the resulting names is to extend the pluralize method in GiixCrudCode.php

With a little change to the templates i18s support can be added so the plurals are taken from the messages files at runtime rather than generate time.



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

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



Hi Doru (mongoose76) and Thiago (Athos),

I have just finished and committed an improvement to giix: the support to labels for active records.

This change will allow:

  • The centralized management of the model and relation labels: you change it in the model and the change will be reflected in the views;
  • Better i18n and number (plural) management: when you implement your model's "label" method, you can set it to use the Yii::t method and vary the source string according to the "$n" parameter.


Please check the GxActiveRecord::label, GxActiveRecord::getRelationLabel and GxActiveRecord::getAttributeLabel methods and their documentation.

To implement the "label" method in your model, see the GxActiveRecord::label documentation and the guide page on i18n/plural forms format.

To use in the views, use the GxActiveRecord::getRelationLabel (recommended most of the time) or directly the model::label methods.

I'd like to know your opinion regarding this enhancement and if it works well for your issues.
Please check the trunk code (revision 117) out and play around with it.

In the meantime I'll work on the generation code and on the templates to leverage this new functionality.

Thanks!
1

#87 User is offline   Rodrigo Coelho 

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

Posted 20 June 2011 - 03:01 AM

Dear,

giix 1.8 is out!

And I feel you will like it. Improvements:
  • Labels for models and relations! See the post above for details.
  • Documentation improvements (for you who like to check the source code).


Don't forget that you must implement the "label" method on each AR that extends from GxActiveRecord when upgrading.

Download it right now!
0

#88 User is offline   Rodrigo Coelho 

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

Posted 21 June 2011 - 01:29 AM

Dear,

giix 1.8 have a bug: it will throw an exception if you use class properties and request a label for it in a view.
The exception text will look like:

Quote

The relation or attribute "name" was not found.


The fix is already online in the code repository, in the trunk. The fix was made in the revision 140.

Thanks Athos for reporting it.
0

#89 User is offline   enfield 

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

Posted 21 June 2011 - 03:38 PM

View Postmentel, on 20 June 2011 - 03:01 AM, said:



Wow mentel, you are keeping me busy just keeping up with your updates. This is not a complaint at all. Thanks again for all the active work you are putting into this. Been using it for awhile now and love what it has to offer. Time to go and get 1.8 and implement that today!
0

#90 User is offline   enfield 

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

Posted 21 June 2011 - 05:03 PM

mentel,
I am not sure I am understanding the approach to labels now. I have went to r1.8 and updated code to r140. Then used giix to create new models and CRUD.

On forms if I have a text input it will use the
public function attributeLabels() { 
for labels as in previous versions. On dropdowns or checkboxes it will use a case conversion of the Model (i.e. SubCategory = Subcategory) where that dropdown is filled from.

Does this mean that I need to modify the generated code for every attribute now that is not from a text field? I am not seeing what needs to be done here to get my labels back to using a simple input like
public function attributeLabels() { 
in the Model.

View Postmentel, on 20 June 2011 - 03:01 AM, said:

Don't forget that you must implement the "label" method on each AR that extends from GxActiveRecord when upgrading.


I know you mentioned this but with newly generated giix models it is there so I think I got that covered although I do need to read up to understand the logic a bit. Maybe that is where my solution is I don't know.


Thanks
0

#91 User is offline   Rodrigo Coelho 

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

Posted 21 June 2011 - 05:23 PM

enfield,

There are some problems with this implementation. Athos have told me about some problems he is having, too.
Please use giix 1.7 until they are fixed (on 1.8.1 or 1.9).

Thanks for understanding.
0

#92 User is offline   enfield 

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

Posted 21 June 2011 - 08:48 PM

mentel, no problem. I poked around a bit more and did some additional reading. I think I have a basic understanding of what you are after here and I think it is a great improvement. Easy enough to continue using 1.7 for now.
0

#93 User is offline   Rodrigo Coelho 

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

Posted 05 July 2011 - 03:13 PM

Dear mongoose76, Athos and enfield,

I finished the updates in the code for proper support to the labels functionality and I'd like to have some opinions and tests.
Could you please check giix out, see the code and perform some tests to check if it is working as it should now?

See the last commit (rev 150) at
http://code.google.c...ce/detail?r=150

Thank you!
0

#94 User is offline   hasanavi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 27-April 11
  • Location:London

Posted 06 July 2011 - 11:37 AM

Hello,

I've set up giix, and login to gii module.

while I'm trying to generate a model using giixmodel generator I've got this error

"Property "CMysqlColumnSchema.autoIncrement" is not defined."

I've also got the same error while I'm trying to use giix crud using my old modules. While the gii is working fine.


any ideas?

Thanks
There are 2 types of people, who uses Yii and who doesn't :)
0

#95 User is offline   Rodrigo Coelho 

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

Posted 06 July 2011 - 12:08 PM

Please open a new issue at Google Code and include the information that is asked there.
With that information, I can help you and fix the possible bug.

Thank you!
0

#96 User is offline   Rodrigo Coelho 

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

Posted 06 July 2011 - 02:20 PM

New version: giix 1.9

Dear,

giix 1.9 is here, and it gives you a smooth experience with active record and relation labels.
This new version improves the labels feature introduced in giix 1.8 and delivers the functionality with performance and flexibility. Give it a try!

I appreciate your votes, keep voting! :)

Don't forget that you must implement the "label" method on each AR model that extends from GxActiveRecord when upgrading. See the UPGRADE file for more information.

Download giix 1.9 right now!
0

#97 User is offline   enfield 

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

Posted 06 July 2011 - 03:53 PM

mentel, I will roll this into an app and test things out over the next couple of days.

I have a question for you also in regards to:
echo GxHtml::link(GxHtml::encode(GxHtml::valueEx($relatedModel)),
  array('model/view', 'id' => GxActiveRecord::extractPkValue($relatedModel, true)));


How can I still utilize this but remove the link?
0

#98 User is offline   Rodrigo Coelho 

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

Posted 06 July 2011 - 04:09 PM

View Postenfield, on 06 July 2011 - 03:53 PM, said:

mentel, I will roll this into an app and test things out over the next couple of days.


Thank you!
Please let me know your feelings about it.

View Postenfield, on 06 July 2011 - 03:53 PM, said:

I have a question for you also in regards to:
echo GxHtml::link(GxHtml::encode(GxHtml::valueEx($relatedModel)),
  array('model/view', 'id' => GxActiveRecord::extractPkValue($relatedModel, true)));


How can I still utilize this but remove the link?


Just remove the call to GxHtml::link. The result:

echo GxHtml::encode(GxHtml::valueEx($relatedModel))

0

#99 User is offline   enfield 

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

Posted 06 July 2011 - 04:19 PM

View Postmentel, on 06 July 2011 - 04:09 PM, said:

Just remove the call to GxHtml::link.


Man I was over thinking that one, trying to get it working while keeping extractPkValue in play. Thanks for the quick help.
0

#100 User is offline   enfield 

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

Posted 08 July 2011 - 05:08 AM

mentel since this

foreach($model->relation as $relatedModel) {
  echo GxHtml::valueEx($relatedModel);

will default to using the representingColumn(), what is the trick to loading a different attribute instead without changing the representingColumn?
0

Share this topic:


  • (14 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • 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