mentel
(Yii)
May 12, 2011, 8:04pm
61
In the page of view’s action, before listing the relations, with a tag <h2> highlight that these are dependent or related records.
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.
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.
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.
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.
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).
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!
Selection of fields is also in the roadmap. Again, you can open an issue and send your code.
I didn’t understand that. Could you please elaborate and, maybe, show some code?
[…] 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.
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
)
);
}
(...)
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.
mentel
(Yii)
May 23, 2011, 8:23am
65
@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.
JFReyes
(Jose Reyes)
May 23, 2011, 2:23pm
66
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.
mentel:
@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.
mentel
(Yii)
May 24, 2011, 12:13am
68
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
mentel
(Yii)
May 24, 2011, 12:17am
69
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.
JFReyes
(Jose Reyes)
May 24, 2011, 6:49pm
70
mentel:
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.
mentel
(Yii)
May 30, 2011, 9:17pm
72
Thank you!
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!
mentel
(Yii)
May 31, 2011, 5:57pm
73
mongoose76:
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!
mentel
(Yii)
May 31, 2011, 5:59pm
74
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.
mentel:
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.
mentel
(Yii)
May 31, 2011, 7:40pm
76
Elfange:
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.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.
mentel
(Yii)
May 31, 2011, 8:15pm
77
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.
Thank you
Example of item 5:
File BaseBanco.php
Thanks again
Your suggestions are on the roadmap and should be integrated into giix.
mentel
(Yii)
May 31, 2011, 8:18pm
78
scoob.junior:
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.
mentel
(Yii)
May 31, 2011, 8:20pm
79
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.
mentel
(Yii)
June 4, 2011, 2:49pm
80
giix 1.7 is here!
All known bugs were fixed:
The code from Yii was updated to the version 1.1.7 (r3135) of the framework.
More to come