Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Symfony][Symfony2] FOSFacebook
Forum PHP.pl > Forum > PHP > Frameworki
muwie
Witam.
Otóż mam mały problem. Zainstalowałem UserBundle i FacebookBundle. Teraz chcąc wykonać tabelę w bazie danych z przykładu wykonuje poniższy kod.
  1. <?php
  2. // src/Acme/UserBundle/Entity/User.php
  3.  
  4. namespace Acme\DemoBundle\Entity;
  5.  
  6. use FOS\UserBundle\Entity\User as BaseUser;
  7. use Doctrine\ORM\Mapping as ORM;
  8.  
  9. /**
  10.  * @ORM\Entity
  11.  * @ORM\Table(name="test")
  12.  */
  13. class User extends BaseUser
  14. {
  15. /**
  16.   * @ORM\Id
  17.   * @ORM\Column(type="integer")
  18.   * @ORM\GeneratedValue(strategy="AUTO")
  19.   */
  20. protected $id;
  21.  
  22. /**
  23.   * @var string
  24.   */
  25. protected $firstname;
  26.  
  27. /**
  28.   * @var string
  29.   */
  30. protected $lastname;
  31.  
  32. /**
  33.   * @var string
  34.   */
  35. protected $facebookID;
  36.  
  37. /**
  38.   * @return string
  39.   */
  40. public function getFirstname()
  41. {
  42. return $this->firstname;
  43. }
  44.  
  45. /**
  46.   * @param string $firstname
  47.   */
  48. public function setFirstname($firstname)
  49. {
  50. $this->firstname = $firstname;
  51. }
  52.  
  53. /**
  54.   * @return string
  55.   */
  56. public function getLastname()
  57. {
  58. return $this->lastname;
  59. }
  60.  
  61. /**
  62.   * @param string $lastname
  63.   */
  64. public function setLastname($lastname)
  65. {
  66. $this->lastname = $lastname;
  67. }
  68.  
  69. /**
  70.   * Get the full name of the user (first + last name)
  71.   * @return string
  72.   */
  73. public function getFullName()
  74. {
  75. return $this->getFirstName() . ' ' . $this->getLastname();
  76. }
  77.  
  78. /**
  79.   * @param string $facebookID
  80.   * @return void
  81.   */
  82. public function setFacebookID($facebookID)
  83. {
  84. $this->facebookID = $facebookID;
  85. $this->setUsername($facebookID);
  86. $this->salt = '';
  87. }
  88.  
  89. /**
  90.   * @return string
  91.   */
  92. public function getFacebookID()
  93. {
  94. return $this->facebookID;
  95. }
  96.  
  97. /**
  98.   * @param Array
  99.   */
  100. public function setFBData($fbdata)
  101. {
  102. if (isset($fbdata['id'])) {
  103. $this->setFacebookID($fbdata['id']);
  104. $this->addRole('ROLE_FACEBOOK');
  105. }
  106. if (isset($fbdata['first_name'])) {
  107. $this->setFirstname($fbdata['first_name']);
  108. }
  109. if (isset($fbdata['last_name'])) {
  110. $this->setLastname($fbdata['last_name']);
  111. }
  112. if (isset($fbdata['email'])) {
  113. $this->setEmail($fbdata['email']);
  114. }
  115. }
  116.  
  117. /**
  118.   * Get id
  119.   *
  120.   * @return integer
  121.   */
  122. public function getId()
  123. {
  124. return $this->id;
  125. }
  126. }

I teraz występuje mój problem. Otóż zamiast tej małej tabeli, tworzy mi się tabela użytkownika, która jest z UserBudndle. Dla ścisłości powiem, że ten plik jest czytany przy mapowaniu i tworzeniu tabeli ponieważ z metadanych bierze nazwę tabeli.
Dziękuje z góry za odpowiedz
destroyerr
Tworzy Ci się taka tabela, bo przecież Twoja klasa Acme\DemoBundle\Entity\User dziedziczy po FOS\UserBundle\Entity\User, która jest też mapowana.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.