Re: [symfony-users] foreign key relations in admin generator

2010-03-17 Thread Arnold Ispan
Hello,

In the client_name partial you could use:
*echo $contract->getClient()->getName();*

and in the generator.yml you could use:

*display: [_client_name, .]*
*
*
*or the second method would be to define a method in your Contract model
class*
*
*
*public function getClientName()*
*{*
* return $this->getClient()->getName()*
*}
*
and then in the generator.yml you could use it like

*display: [clientName, .]*

Hope it helps you :)

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

[symfony-users] foreign key relations in admin generator

2010-03-17 Thread Mihai Rusoaie
Hello, all!

Can you give me a hint on how can I display a name from a foreign
table in the list display view in a generated backend. To be more
precise, here is the schema:

client:
   id:   ~
   name: { type: varchar(255), required: true, index:
unique }

contract:
   id: ~
   client_id:  { type: integer, foreignTable: client,
foreignReference: id, required: true }

In the contract generated admin list view I want to display the name
of the client:

  list:
title: Lista contracte
display: [id, client_id, =client_name, sign_date, start_date]


In order to do this, I can create a partial client_name.php, but I
don't have access to the Client object from here...

Can you please give me a hint how else I can do this?

Thank you,

Mihai

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en