replaceOldVarSyntax example



class Migrations_Migration626 extends Shopware\Components\Migrations\AbstractMigration
{
    public function up($modus)
    {
        $query = $this->getConnection()->query('SELECT id, content, contentHTML FROM `s_core_config_mails` WHERE dirty = 0');
        $untouchedMails = $query->fetchAll();

        foreach ($untouchedMails as $mail) {
            $replacedContent = $this->replaceOldVarSyntax($mail['content']);
            $replacedContentHTML = $this->replaceOldVarSyntax($mail['contentHTML']);

            if ($replacedContent != $mail['content'] || $replacedContentHTML != $mail['contentHTML']) {
                $mailId = $mail['id'];

                $replacedContent = !empty($replacedContent) ? trim($this->getConnection()->quote($replacedContent), "'") : '';
                $replacedContentHTML = !empty($replacedContentHTML) ? trim($this->getConnection()->quote($replacedContentHTML), "'") : '';

                $sql = <<<EOL UPDATE `s_core_config_mails` SET content="
Home | Imprint | This part of the site doesn't use cookies.