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