Re : Re: [symfony-users] Symfony 2 - Doctrine and inheritance

2011-06-15 Thread Jérémy Simonklein
Thank you for your responses.
I use the annotation method of Doctrine 2 for my entities.
I've searched a little on the doctrine 2 documentation and the Single Table 
Inheritance is perfect in my case ^^
Thank you yet ;)

-- 
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] Symfony 2 - Doctrine and inheritance

2011-06-14 Thread Jérémy Simonklein
Hi all,

I would want to create 2 different classes GT and FT from a parent class 
T. 
I want GT and FT to have same attributes thant T, but FT and GT should have 
two additionnal different attributes.
How can I do it ? 
I've searched for doctrine inheritance but nothing about it for Symphony 
2...

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


Re: [symfony-users] Symfony 2 - Doctrine and inheritance

2011-06-14 Thread Marco Pivetta
class T {
   protected $commonField1;
   protected $commonField2;
}

class GT extends T {
   protected $otherField1;
   protected $otherField2;
}

class FT extends T {
   protected $otherField3;
   protected $otherField4;
}

This is for plain PHP... If you need to implement that in Doctrine 2 you
just need to decide if you want to use an @MappedSuperclass or a single or
joined table inheritance type :)

Marco Pivetta
http://twitter.com/Ocramius
http://marco-pivetta.com



On 14 June 2011 14:47, Jérémy Simonklein jeremy.simonkl...@gmail.comwrote:

 Hi all,

 I would want to create 2 different classes GT and FT from a parent
 class T.
 I want GT and FT to have same attributes thant T, but FT and GT should have
 two additionnal different attributes.
 How can I do it ?
 I've searched for doctrine inheritance but nothing about it for Symphony
 2...

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


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


Re: [symfony-users] Symfony 2 - Doctrine and inheritance

2011-06-14 Thread Christophe COEVOET

Le 14/06/2011 14:47, Jérémy Simonklein a écrit :

Hi all,

I would want to create 2 different classes GT and FT from a parent 
class T.
I want GT and FT to have same attributes thant T, but FT and GT should 
have two additionnal different attributes.

How can I do it ?
I've searched for doctrine inheritance but nothing about it for 
Symphony 2...
Look at the doc on the Doctrine website. Entity inheritance is a feature 
of Doctrine. The Symfony2 doc is not about documenting all Doctrine 
features again.


--
Christophe | Stof

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