![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 33 Pomógł: 1 Dołączył: 8.05.2010 Ostrzeżenie: (0%) ![]() ![]() |
witam
mam problem związany z dodawanie do bazy połączonej tabeli, oto kod schema.yml: autorzy: id: { type: INTEGER, primaryKey: true, autoIncrement: true, required: true } imie: { type: VARCHAR, size: '20', required: false } nazwisko: { type: VARCHAR, size: '30', required: false } ksiazka: autor1: { type: INTEGER, required: true, foreignTable: autorzy, foreignReference: id } autor2: { type: INTEGER, required: false, foreignTable: autorzy, foreignReference: id } autor3: { type: INTEGER, required: false, foreignTable: autorzy, foreignReference: id } temat: { type: VARCHAR,size: '255', required: true } id: { type: INTEGER, primaryKey: true, autoIncrement: true, required: true } kod formularza ksiazkaform.class.php: unset($this['autor1'],$this['autor2'],$this['autor3']); $autor = $this->getObject()->getAutor1(); $autor2 = $this->getObject()->getAutor2(); $autor3 = $this->getObject()->get\Autor3(); if((is_null($autor))||(is_null($autor2))||(is_null($autor3))) { $autor = new Autorzy(); $this->getObject()->setAutorzyRelatedByAutor1($autor); $autor2 = new Autorzy(); $this->getObject()->setAutorzyRelatedByAutor2($autor2); $autor3 = new Autorzy(); $this->getObject()->setAutorzyRelatedByAutor3($autor3); } $this->embedForm('autor',new AutorzyForm($autor)); $this->embedForm('autor2',new AutorzyForm($autor2)); $this->embedForm('autor3',new AutorzyForm($autor3)); Dane dodawane są poprawnie, lecz jezeli nie wypełnie jednej z połączonych z tabel a dokladnie autor2 lub autor3, to dodaje mi do tabeli Autorzy wartości zerowe.Moje pytanie jest nastepujące: jezeli nie wypełnie autor2 lub autor3 to chcialbym zeby nie zostały dodawane puste biale znaki do tej tabeli tzn aby w takiej sytuacji nie zostały dodawane dane do tej tabeli tylko w przypadku jej wypelnienia z góry dzieki z podpowiedzi Ten post edytował lukasz10 5.06.2010, 13:35:33 |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 12.07.2025 - 15:26 |