Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Symfony Encje
Malinaa
post
Post #1





Grupa: Zarejestrowani
Postów: 578
Pomógł: 6
Dołączył: 21.07.2008

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


Witam, mam kłopot przy tworzeniu encji w Symfony,

Tworzę encje np.

  1. class User implements UserInterface
  2. {
  3. /**
  4.   * @ORM\Id
  5.   * @ORM\GeneratedValue
  6.   * @ORM\Column(type="integer")
  7.   */
  8. private $id;
  9.  
  10. public function getId(): ?int
  11. {
  12. return $this->id;
  13. }
  14. }


a chcę, aby było tak:

1. tabela z prefixem = ok / zrobione
2. klucz - id_user / standardowo generuje id i nie mogę zmienić na id_user bo się wysypuje

  1. class DbmUsers implements UserInterface
  2. {
  3. /**
  4.   * @ORM\Id
  5.   * @ORM\GeneratedValue
  6.   * @ORM\Column(type="integer")
  7.   */
  8. private $id_user;
  9.  
  10. public function getIdUser(): ?int
  11. {
  12. return $this->id_user;
  13. }
  14. }


Wykonuje migracje: php bin/console make:migration
i wyskakuje błąd: Column name `id` referenced for relation from App\Entity\DbmUsers towards App\Entity\DbmUsersProfile does not exist.

Jak zmienić automatycznie wygenerowane id na id_user?

Ten post edytował Malinaa 3.02.2021, 23:03:56
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: 24.12.2025 - 20:37