Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Doctrine inheritance, Concrete Table Inheritance
Fluke
post
Post #1





Grupa: Zarejestrowani
Postów: 247
Pomógł: 9
Dołączył: 20.09.2010
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Witam,

mam taką strukturę tabel:
(IMG:http://oi39.tinypic.com/a2xeur.jpg)

Teraz moje pytanie, czy w jakiś sposób Doctrine 2 pozwala na takie dziedziczenie ale bez podawania discriminator column ?
Aby mieć taki kod:

  1. /**
  2.  * @MappedSuperclass
  3.  */
  4. abstract class Person
  5. {
  6. public $id;
  7. public $name;
  8. public $surname;
  9. }
  10.  
  11. /**
  12.  * @Entity
  13.  */
  14. class Student extends Person
  15. {
  16. public $rok;
  17. }
  18.  
  19. /**
  20.  * @Entity
  21.  */
  22. class Profesor extends Person
  23. {
  24. public $wykladow;
  25. }


Z góry dzięki i pozdrawiam (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Fluke
post
Post #2





Grupa: Zarejestrowani
Postów: 247
Pomógł: 9
Dołączył: 20.09.2010
Skąd: Kraków

Ostrzeżenie: (0%)
-----


  1. /**
  2.  * @Entity
  3.  * @Table(name="person")
  4.  * @MappedSuperclass
  5.  */
  6. abstract class Person {
  7. /**
  8.   * @Id
  9.   * @Column(type="integer")
  10.   * @GeneratedValue(strategy="AUTO")
  11.   */
  12. protected $id;
  13. }
  14.  
  15. /**
  16.  * @Entity
  17.  * @Table(name="student")
  18.  */
  19. class Student extends Person {
  20.  
  21. }


I teraz w klasie Student dodać odpowiednią adnotację. Tylko, że nie wiem czy takie coś istnieje w doctrine. Ale uważam, że jest to sensowne.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 21:04