(English) concrete5 beginner’s guide 2nd edition

Leider ist der Eintrag nur auf English verfügbar.




3 Comments

Handling multiple block Versions …

Please keep in mind that after “duplicate” follows “save”, which overrides “replacesBlockID” with the “old value”, in most cases “NULL”.

The regarding code “UPDATE … SET replacesBlockID= …” should be placed in the “store” function.

To add to Manfred’s comment, as I’ve recently been stuck on this, to get this working the “duplicate” and “save” methods need to resemble the following:-

public function duplicate($newbID)
{
parent::duplicate($newbID);

$db = Loader::db();
$db->Execute(‘UPDATE btProductInformation SET replacesBlockID=? WHERE bID=?’,array($this->bID,$newbID));
}

public function save($data)
{
if ( isset($this->replacesBlockID) && $this->replacesBlockID) {
$data[‘replacesBlockID’] = $this->replacesBlockID;
}

parent::save($data);
}

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *