Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Symfony - tinyint jako klucz, relacja z drugą tabelą
Malinaa
post
Post #1





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

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


Witam, mam encje i tworzę kolumnę kategorie

/**
* @ORM\ManyToOne(targetEntity=DbmGalleriesCategory::class, inversedBy="dbmGalleries")
* @ORM\JoinColumn(nullable=false)
*/
private $category;

po utworzeniu migracji daje mi to w tabeli bazy danych typ: int(11)

Nie potrzebne jest tu jednak int(11) wystarczy tinyint(2),
wszystkich kategorii jest mniej iż 100 i nigdy więcej tu nie będzie.

Jak zmienić encje, aby po migracji dała w bazie danych typ: tinyint(2) ?

Ten post edytował Malinaa 1.07.2021, 21:19:39
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




* @ORM\Column(type="tinyint")

Dokumentacja czy google naprawde nie boli (IMG:style_emoticons/default/wink.gif)

Nie mniej jednak powinienies miec na uwadze ze albo mozesz miec problemy albo juz beda bo

Cytat
There is no tinyint type in Doctrine 2. Reason is straightforward:

A Doctrine type defines the conversion between PHP and SQL types, independent from the database vendor you are using. All Mapping Types that ship with Doctrine are fully portable between the supported database systems.

You should pick one of these:

integer: Type that maps a SQL INT to a PHP integer.
smallint: Type that maps a database SMALLINT to a PHP integer.
bigint: Type that maps a database BIGINT to a PHP string.

Ale dawno sie nie bawilem w doctrine wiec moze to olali
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: 14.10.2025 - 07:29