Nachtrag: 15.02.2018
Der Fehler scheint sich mit Contao 4.5.4 erledigt zu haben. Die uuid Zuweisung funktioniert, wie sie soll.
Hallo liebe community
Vorab euch allen ein frohes Neujahr.
Seit ich bei mehreren Installationen auf Contao 4.5 gewechselt habe, taucht in mehreren Erweiterungen bei der Zuweisung einer uuid zu einem Model ein Fehler auf. Die uuid wird nicht in die Datenbank übernommen, wenn die save() Methode vor der Zuweisung schon einmal aufgerufen wurde. Dazu habe ich unten zwei Schnipsel angehängt.
Das ganze in einer funktionierenden Version ist auf github ab Zeile 85 zu sehen:
Uuid wird nicht gespeichert. Nachdem Model zum ersten Mal gespeichert wurde.
Code:
$objPictureModel = new \GalleryCreatorPicturesModel();
$objPictureModel->tstamp = time();
$objPictureModel->pid = $somePid;
$objPictureModel->save();
// some more code
// ....
$objPictureModel->foo = 'bar';
// Set uuid
$objPictureModel->uuid = $objFilesModel->uuid;
// Call $objPictureModel->save() for the second time
$objPictureModel->save();
// Uuid will not be saved to the db!!!!
So funktioniert die Zuweisung der uuid:
Code:
$objPictureModel = new \GalleryCreatorPicturesModel();
$objPictureModel->tstamp = time();
$objPictureModel->pid = $objAlbumModel->id;
$objPictureModel->externalFile = $blnExternalFile ? "1" : "";
// Set uuid before model is saved the first time!!!
$objPictureModel->uuid = $objFilesModel->uuid;
$objPictureModel->save();
// some more code
// ....
$objPictureModel->foo = 'bar';
// Call $objPictureModel->save() for the second time
$objPictureModel->save();
// Uuid will be saved to the db!!!!
Weiss jemand, woran das liegt?
Liebe Grüsse
Marko
Lesezeichen