I’m migrating code from Symfony1.0 to Symfony 1.4.
Created a admin module called: mymodel using Propel.
The database of that model is like this:
table: mymodel_table.
column: fkLabelId
column: fkRightsOwnerId
NOTE: both are foreing keys.
They are connected this way -again in the physical DB-:
fkLabelId -------> REFER `DB/label`(`id`);
fkRightsOwnerId -------> REFER `DB/ownersright`(`id`);
Now, I created the admin-module in my project –cms in the following code-:
php symfony propel:generate-admin cms --module=myModel MyModelTable
In my page I can see the info of the table mymodel_table, this is: both id. But I would like to see the info referenced in the other two tables.
This is the config.yml OF THE SYMFONY 1.0 VERSION:
generator:
class: sfPropelAdminGenerator
param:
model_class: MyModel
theme: default
fields:
fk_label_id: {params: disabled=false}
fk_rightsowner_id: {params: disabled=false}
list:
filters: [fklabelid, _label_filter, fkrightsownerid, _rightsowner_filter]
peer_method: doSelectJoinAll
display: [=_label_list, =_rightsowner_list]
actions:
actions:
_create: ~
object_actions:
_edit: ~
_delete: ~
edit:
display: [=_label_edit, =_rightsowner_edit]
actions:
_list: ~
_save_and_list: ~
_save: ~
_delete: ~
This is the config.yml OF THE SYMFONY 1.4 VERSION:
generator:
class: sfPropelGenerator
param:
model_class: MyModel
theme: admin15
non_verbose_templates: true
with_show: false
singular: MyModel
plural: MyModel
route_prefix: My_model
with_propel_route: 1
actions_base_class: sfActions
config:
actions: ~
fields:
fk_label_id: {params: disabled=false}
fk_rightsowner_id: {params: disabled=false}
list:
filters: [fklabelid, _label_filter, fkrightsownerid, _rightsowner_filter]
// peer_method: doSelectJoinAll ("commented")
// display: [=_label_list, =_rightsowner_list] ("commented")
filter: ~
form: ~
edit: ~
new: ~
In mypage.com/dev.php/mymodel I get:
500 | Internal Server Error | InvalidArgumentException
Your generator configuration contains some errors for the "list" context. The following configuration cannot be parsed: array( 'filters' => array( 0 => 'fklabelid', 1 => '_label_filter', 2 => 'fkrightsownerid', 3 => '_rightsowner_filter', ),).
In the Symfony page did not find good examples this this cases!. Tried many permutations of the 1.0 version. Changing things, adding the foreign command in the config.yml.
I would appreciate any help.
EDIT:
As I was suggested I’m doing the partials. I created a _Label_list.php. Redirect the info from the foreign key to the destiny table. In the file, I’m doing something like that:
$rights = RightsOwnerQuery::create()->findPk($MyModel->getFkRightsOwnerId());
//Print the Info
echo $rights->getPrice() . ' ('. $rights->getId() . ')';
The old
list > filtersin symfony 1.0 have been moved to a dedicated entryfilterin symfony 1.4.You now have to use
filterat the same level oflist.By the way, be careful, field started with “_” are partial. So don’t forget to create partial (I guess they are already exists in the symfony 1.0).
Edit:
About partial, you have to create them in the templates directory of the admin module:
I don’t often fo partial for filters, but dig into the generated code in cache folder to see how you can retrieve the FormFilter object and do want ever you want with