Uczę się Symfony2.

Plik Strony.php:
  1. <?php
  2.  
  3. namespace Acme\StronaBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6.  
  7.  
  8. /**
  9.  * @ORM\Entity
  10.  * @ORM\Table(name="strony")
  11.  */
  12. class Strony
  13. {
  14. /**
  15.   * @ORM\Id
  16.   * @ORM\Column(name="id_strony", type="integer", nullable=false)
  17.   * @ORM\GeneratedValue(strategy="AUTO")
  18.   */
  19. protected $IdStrony;
  20.  
  21. /**
  22.   * @ORM\Column(name="meta_tytul", type="string", length=50, nullable=false)
  23.   */
  24. protected $MetaTytul;
  25.  
  26. }


Plik BlokiStron.php:
  1. <?php
  2.  
  3. namespace Acme\StronaBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6.  
  7.  
  8. /**
  9.  * @ORM\Entity
  10.  * @ORM\Table(name="bloki_stron")
  11.  */
  12. class BlokiStron
  13. {
  14. /**
  15.   * @ORM\Id
  16.   * @ORM\Column(name="id_bloku_strony", type="integer", nullable=false)
  17.   * @ORM\GeneratedValue(strategy="AUTO")
  18.   */
  19. protected $IdBlokuStrony;
  20.  
  21. /**
  22.   * @ORM\Column(name="id_strony", type="integer", nullable=false)
  23.   * @ORM\ManyToOne(targetEntity="Strony")
  24.   * @ORM\JoinColumn(name="id_strony", referencedColumnName="id_strony")
  25.   */
  26. protected $Strona;
  27.  
  28. /**
  29.   * @ORM\Column(name="tytul", type="string", length=50, nullable=false)
  30.   */
  31. protected $Tytul;
  32.  
  33. /**
  34.   * @ORM\Column(name="tresc", type="text", nullable=true)
  35.   */
  36. protected $Tresc;
  37.  
  38. }


Jedna strona może mieć wiele bloków.

Dlaczego po wydaniu komendy php app/console doctrine:schema:update --force
tworzy mi w bazie 2 tabele, ale gdy wchodzę do tabeli bloki_stron - widok relacyjny to nie widzę połączenia między obiema tabelami:
http://imageshack.us/photo/my-images/560/beztytuuhje.jpg/

Co robię źle?

------------------------------------------------------------------------------------------

Dobra, wiem, przyczyną było dodanie przeze mnie do klucza obcego:

  1. @ORM\Column(name="id_strony", type="integer", nullable=false)