[Changed] php cs fixer adjustments

This commit is contained in:
MaxBuhe01 2024-11-20 18:50:18 +01:00
parent 8d3421450b
commit 8f046ed231
12 changed files with 428 additions and 291 deletions

View File

@ -1,5 +1,18 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1); declare(strict_types=1);
namespace D3\ManufacturerInformation\Application\Controller\Admin; namespace D3\ManufacturerInformation\Application\Controller\Admin;
@ -12,118 +25,118 @@ use OxidEsales\Eshop\Core\Registry;
class ManufacturerInfoLongdesc extends AdminDetailsController class ManufacturerInfoLongdesc extends AdminDetailsController
{ {
/** /**
* @return string * @return string
*/ */
public function render() public function render()
{ {
parent::render(); parent::render();
/** @var Manufacturer|D3ManufacturerLongDesc $oManufacturer */ /** @var Manufacturer|D3ManufacturerLongDesc $oManufacturer */
$this->_aViewData['edit'] = $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class); $this->_aViewData['edit'] = $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
$sOXID = $this->_aViewData["oxid"] = $this->getEditObjectId(); $sOXID = $this->_aViewData["oxid"] = $this->getEditObjectId();
if (isset($sOXID) && $sOXID != "-1") { if (isset($sOXID) && $sOXID != "-1") {
// load object // load object
$d3manufacturerlang = \OxidEsales\Eshop\Core\Registry::getRequest()->getRequestEscapedParameter("catlang"); $d3manufacturerlang = \OxidEsales\Eshop\Core\Registry::getRequest()->getRequestEscapedParameter("catlang");
if (!isset($d3manufacturerlang)) { if (!isset($d3manufacturerlang)) {
$d3manufacturerlang = $this->_iEditLang; $d3manufacturerlang = $this->_iEditLang;
} }
$this->_aViewData["catlang"] = $d3manufacturerlang; $this->_aViewData["catlang"] = $d3manufacturerlang;
$oManufacturer->loadInLang($d3manufacturerlang, $sOXID); $oManufacturer->loadInLang($d3manufacturerlang, $sOXID);
//Disable editing for derived items //Disable editing for derived items
if ($oManufacturer->isDerived()) { if ($oManufacturer->isDerived()) {
$this->_aViewData['readonly'] = true; $this->_aViewData['readonly'] = true;
} }
foreach (\OxidEsales\Eshop\Core\Registry::getLang()->getLanguageNames() as $id => $language) { foreach (\OxidEsales\Eshop\Core\Registry::getLang()->getLanguageNames() as $id => $language) {
$oLang = new \stdClass(); $oLang = new \stdClass();
$oLang->sLangDesc = $language; $oLang->sLangDesc = $language;
$oLang->selected = ($id == $this->_iEditLang); $oLang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $oLang; $this->_aViewData["otherlang"][$id] = clone $oLang;
} }
} }
$this->_aViewData["editor"] = $this->generateTextEditor("100%", 280, $oManufacturer, $oManufacturer->getD3LongDescTableColumnName(), "list.css"); $this->_aViewData["editor"] = $this->generateTextEditor("100%", 280, $oManufacturer, $oManufacturer->getD3LongDescTableColumnName(), "list.css");
return "@d3manufacturerinformation/admin/d3manufacturerlongdesc"; return "@d3manufacturerinformation/admin/d3manufacturerlongdesc";
} }
/** /**
* @return void * @return void
* @throws \Exception * @throws \Exception
*/ */
public function save() public function save()
{ {
parent::save(); parent::save();
$iManufacturerLang = intval(\OxidEsales\Eshop\Core\Registry::getRequest()->getRequestEscapedParameter("catlang")); $iManufacturerLang = intval(\OxidEsales\Eshop\Core\Registry::getRequest()->getRequestEscapedParameter("catlang"));
$sOXID = $this->getEditObjectId(); $sOXID = $this->getEditObjectId();
$this->setEditObjectId($sOXID); $this->setEditObjectId($sOXID);
if ($sOXID == "-1") { if ($sOXID == "-1") {
return; return;
} }
/** @var Manufacturer|D3ManufacturerLongDesc $oManufacturer */ /** @var Manufacturer|D3ManufacturerLongDesc $oManufacturer */
$oManufacturer = oxNew(Manufacturer::class); $oManufacturer = oxNew(Manufacturer::class);
$oManufacturer->loadInLang($iManufacturerLang, $sOXID); $oManufacturer->loadInLang($iManufacturerLang, $sOXID);
if (!$oManufacturer->load($sOXID)) { if (!$oManufacturer->load($sOXID)) {
return; return;
} }
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval"); $aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
$oManufacturer->assign($aParams); $oManufacturer->assign($aParams);
if (false === is_null($this->d3GetLongdescParamValue($oManufacturer))) { if (false === is_null($this->d3GetLongdescParamValue($oManufacturer))) {
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue($oManufacturer)); $oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue($oManufacturer));
$oManufacturer->save(); $oManufacturer->save();
} }
} }
/** /**
* @param $oManufacturer * @param $oManufacturer
* @param $sField * @param $sField
* @return string * @return string
*/ */
protected function getEditValue($oManufacturer, $sField) protected function getEditValue($oManufacturer, $sField)
{ {
$sEditObjectValue = ''; $sEditObjectValue = '';
if ($oManufacturer and $oManufacturer->getId()) { if ($oManufacturer and $oManufacturer->getId()) {
$sEditObjectValue = $oManufacturer->getFieldData(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME); $sEditObjectValue = $oManufacturer->getFieldData(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME);
} }
return $sEditObjectValue; return $sEditObjectValue;
} }
/** /**
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer * @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
* @return string * @return string
*/ */
public function d3GetLongdescParamValue(Manufacturer $oManufacturer) :string public function d3GetLongdescParamValue(Manufacturer $oManufacturer): string
{ {
return (string) $aParams = Registry::getRequest()->getRequestEscapedParameter("editval")[$oManufacturer->getD3LongDescTableColumnName()]; return (string) $aParams = Registry::getRequest()->getRequestEscapedParameter("editval")[$oManufacturer->getD3LongDescTableColumnName()];
} }
/** /**
* inhaltliche Uebernahme analog Article_Main * inhaltliche Uebernahme analog Article_Main
* wird genutzt zum Abspeichern der Artikel-Langbeschreibung * wird genutzt zum Abspeichern der Artikel-Langbeschreibung
* *
* @param $sValue * @param $sValue
* *
* @return mixed * @return mixed
*/ */
protected function processLongDesc($sValue) protected function processLongDesc($sValue)
{ {
$aSearch = ['&amp;nbsp;', '&amp;', '&quot;', '&lang=', '<p>&nbsp;</p>', '<p>&nbsp; </p>']; $aSearch = ['&amp;nbsp;', '&amp;', '&quot;', '&lang=', '<p>&nbsp;</p>', '<p>&nbsp; </p>'];
$aReplace = ['&nbsp;', '&', '"', '&amp;lang=', '', '']; $aReplace = ['&nbsp;', '&', '"', '&amp;lang=', '', ''];
return str_replace($aSearch, $aReplace, $sValue); return str_replace($aSearch, $aReplace, $sValue);
} }
} }

View File

@ -1,14 +1,26 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1); declare(strict_types=1);
namespace D3\ManufacturerInformation\Application\Model; namespace D3\ManufacturerInformation\Application\Model;
class Constants class Constants
{ {
public const OXID_MODULE_ID = 'd3manufacturerinformation'; public const OXID_MODULE_ID = 'd3manufacturerinformation';
// Tables and Database // Tables and Database
public const D3_OXMANUFACTURERS_LONGDESC_FIELDNAME = 'd3description'; public const D3_OXMANUFACTURERS_LONGDESC_FIELDNAME = 'd3description';
} }

View File

@ -1,13 +1,26 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
$sLangName = "Deutsch"; $sLangName = "Deutsch";
// ------------------------------- // -------------------------------
// RESOURCE IDENTITFIER = STRING // RESOURCE IDENTITFIER = STRING
// ------------------------------- // -------------------------------
$aLang = array( $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'mxd3manufacturerinfolongdesc' => 'Langtext', 'mxd3manufacturerinfolongdesc' => 'Langtext',
'SHOP_MODULE_GROUP_d3manufacturerinformation_main' => 'Einstellungen', 'SHOP_MODULE_GROUP_d3manufacturerinformation_main' => 'Einstellungen',
'SHOP_MODULE_d3manufacturerinformation_showManufacturertextOnDetailsPage' => 'vorhandene Herstellertexte auf Artikeldetails als Tab anzeigen' 'SHOP_MODULE_d3manufacturerinformation_showManufacturertextOnDetailsPage' => 'vorhandene Herstellertexte auf Artikeldetails als Tab anzeigen',
); ];

View File

@ -1,13 +1,26 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
$sLangName = "Deutsch"; $sLangName = "Deutsch";
// ------------------------------- // -------------------------------
// RESOURCE IDENTITFIER = STRING // RESOURCE IDENTITFIER = STRING
// ------------------------------- // -------------------------------
$aLang = array( $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'mxd3manufacturerinfolongdesc' => 'Text', 'mxd3manufacturerinfolongdesc' => 'Text',
'SHOP_MODULE_GROUP_d3manufacturerinformation_main' => 'Settings', 'SHOP_MODULE_GROUP_d3manufacturerinformation_main' => 'Settings',
'SHOP_MODULE_d3manufacturerinformation_showManufacturertextOnDetailsPage' => 'display existing manufacturer texts on item details as a tab' 'SHOP_MODULE_d3manufacturerinformation_showManufacturertextOnDetailsPage' => 'display existing manufacturer texts on item details as a tab',
); ];

View File

@ -1,11 +1,24 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
$sLangName = "Deutsch"; $sLangName = "Deutsch";
// ------------------------------- // -------------------------------
// RESOURCE IDENTITFIER = STRING // RESOURCE IDENTITFIER = STRING
// ------------------------------- // -------------------------------
$aLang = array( $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'mxd3manufacturerinfolongdesc' => 'Langtext', 'mxd3manufacturerinfolongdesc' => 'Langtext',
); ];

View File

@ -1,11 +1,24 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
$sLangName = "Deutsch"; $sLangName = "Deutsch";
// ------------------------------- // -------------------------------
// RESOURCE IDENTITFIER = STRING // RESOURCE IDENTITFIER = STRING
// ------------------------------- // -------------------------------
$aLang = array( $aLang = [
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'mxd3manufacturerinfolongdesc' => 'Text', 'mxd3manufacturerinfolongdesc' => 'Text',
); ];

View File

@ -1,24 +1,28 @@
<?php <?php
/** /**
* This Software is the property of Data Development and is protected * Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
* by copyright law - it is NOT Freeware. *
* Any unauthorized use of this software without a valid license * For the full copyright and license information, please view
* is a violation of the license agreement and will be prosecuted by * the LICENSE file that was distributed with this source code.
* civil and criminal law. *
* http://www.shopmodule.com * https://www.d3data.de
* *
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch) * @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com> * @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link http://www.oxidmodule.com * @link https://www.oxidmodule.com
*/ */
namespace D3\ManufacturerInformation\Modules\Application\Model{ namespace D3\ManufacturerInformation\Modules\Application\Model{
use OxidEsales\Eshop\Application\Model\Manufacturer; use OxidEsales\Eshop\Application\Model\Manufacturer;
use OxidEsales\Eshop\Application\Model\ManufacturerList; use OxidEsales\Eshop\Application\Model\ManufacturerList;
class D3ManufacturerLongDesc_parent extends Manufacturer {} class D3ManufacturerLongDesc_parent extends Manufacturer
{
}
class ManufacturerInfoList_parent extends ManufacturerList {} class ManufacturerInfoList_parent extends ManufacturerList
{
}
} }

View File

@ -1,47 +1,59 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1); declare(strict_types=1);
namespace D3\ManufacturerInformation\Modules\Application\Model; namespace D3\ManufacturerInformation\Modules\Application\Model;
use D3\ManufacturerInformation\Application\Model\Constants; use D3\ManufacturerInformation\Application\Model\Constants;
use OxidEsales\Eshop\Application\Model\Manufacturer; use OxidEsales\Eshop\Application\Model\Manufacturer;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent
{ {
/** /**
* @param string $sValue * @param string $sValue
* @return void * @return void
*/ */
public function d3SetLongdesc(string $sValue) :bool public function d3SetLongdesc(string $sValue): bool
{ {
if ($this->getId() and $this->isLoaded()){ if ($this->getId() and $this->isLoaded()) {
try { try {
$this->assign([Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME => $sValue]); $this->assign([Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME => $sValue]);
$this->save(); $this->save();
}catch (\Exception $exception){ } catch (\Exception $exception) {
Registry::getLogger()->error($exception->getMessage()); Registry::getLogger()->error($exception->getMessage());
} }
} }
return true; return true;
} }
/** /**
* @return string * @return string
*/ */
public function d3GetLongdesc(): string public function d3GetLongdesc(): string
{ {
return $this->getFieldData(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME); return $this->getFieldData(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME);
} }
/** /**
* @return string * @return string
*/ */
public function getD3LongDescTableColumnName() :string public function getD3LongDescTableColumnName(): string
{ {
return $sParamName = $this->getViewName(true).'__'.Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME; return $sParamName = $this->getViewName(true).'__'.Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME;
} }
} }

View File

@ -1,10 +1,22 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1); declare(strict_types=1);
namespace D3\ManufacturerInformation\Modules\Application\Model; namespace D3\ManufacturerInformation\Modules\Application\Model;
use D3\ManufacturerInformation\Application\Model\Constants; use D3\ManufacturerInformation\Application\Model\Constants;
use OxidEsales\Eshop\Application\Model\Manufacturer; use OxidEsales\Eshop\Application\Model\Manufacturer;
use OxidEsales\Eshop\Application\Model\ManufacturerList; use OxidEsales\Eshop\Application\Model\ManufacturerList;
@ -12,14 +24,14 @@ use OxidEsales\Eshop\Core\Field;
class ManufacturerInfoList extends ManufacturerInfoList_parent class ManufacturerInfoList extends ManufacturerInfoList_parent
{ {
/** /**
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer * @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
* @return void * @return void
*/ */
protected function addCategoryFields($oManufacturer) protected function addCategoryFields($oManufacturer)
{ {
parent::addCategoryFields($oManufacturer); parent::addCategoryFields($oManufacturer);
$oManufacturer->oxcategories__oxlongdesc = new Field($oManufacturer->getFieldData(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME), Field::T_RAW); $oManufacturer->oxcategories__oxlongdesc = new Field($oManufacturer->getFieldData(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME), Field::T_RAW);
} }
} }

View File

@ -1,13 +1,15 @@
<?php <?php
/** /**
* For the full copyright and license information, please view the LICENSE * Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
* file that was distributed with this source code. *
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* *
* https://www.d3data.de * https://www.d3data.de
* *
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch) * @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com> * @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com * @link https://www.oxidmodule.com
*/ */
@ -27,11 +29,11 @@ $sMetadataVersion = '2.1';
*/ */
$aModule = [ $aModule = [
'id' => Constants::OXID_MODULE_ID, 'id' => Constants::OXID_MODULE_ID,
'title' => [ 'title' => [
'de' => '(D3) Herstellerinformationen', 'de' => '(D3) Herstellerinformationen',
'en' => '(D3) Manufacturer information', 'en' => '(D3) Manufacturer information',
], ],
'description' => [ 'description' => [
'de' => 'fügt Informationen der Hersteller zur Artikelliste hinzu', 'de' => 'fügt Informationen der Hersteller zur Artikelliste hinzu',
'en' => 'adds manufacturer information to the article list', 'en' => 'adds manufacturer information to the article list',
], ],
@ -41,21 +43,21 @@ $aModule = [
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/', 'url' => 'https://www.oxidmodule.com/',
'controllers' => [ 'controllers' => [
"d3manufacturerinfolongdesc" => ManufacturerInfoLongdesc::class "d3manufacturerinfolongdesc" => ManufacturerInfoLongdesc::class,
], ],
'extend' => [ 'extend' => [
OEManufacturer::class => D3ManufacturerLongDesc::class, OEManufacturer::class => D3ManufacturerLongDesc::class,
OEManufacturerList::class => ManufacturerInfoList::class OEManufacturerList::class => ManufacturerInfoList::class,
], ],
'templates' => [ 'templates' => [
'@' . Constants::OXID_MODULE_ID . '/admin/d3manufacturerlongdesc.tpl' => 'views/smarty/admin/d3manufacturerlongdesc.tpl', '@' . Constants::OXID_MODULE_ID . '/admin/d3manufacturerlongdesc.tpl' => 'views/smarty/admin/d3manufacturerlongdesc.tpl',
], ],
'settings' => [ 'settings' => [
[ [
'group' => $sModuleId.'_main', 'group' => $sModuleId.'_main',
'name' => $sModuleId.'_showManufacturertextOnDetailsPage', 'name' => $sModuleId.'_showManufacturertextOnDetailsPage',
'type' => 'bool', 'type' => 'bool',
'value' => true 'value' => true,
], ],
], ],
'blocks' => [ 'blocks' => [
@ -69,5 +71,5 @@ $aModule = [
'block' => 'details_tabs_invite', 'block' => 'details_tabs_invite',
'file' => 'Application/views/blocks/page/details/inc/details_tabs_invite.html.tpl', 'file' => 'Application/views/blocks/page/details/inc/details_tabs_invite.html.tpl',
], ],
] ],
]; ];

View File

@ -1,5 +1,18 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1); declare(strict_types=1);
namespace D3\ManufacturerInformation\Migrations; namespace D3\ManufacturerInformation\Migrations;
@ -13,36 +26,38 @@ use Doctrine\Migrations\AbstractMigration;
*/ */
final class Version20241023154223 extends AbstractMigration final class Version20241023154223 extends AbstractMigration
{ {
public function getDescription() : string public function getDescription(): string
{ {
return 'Adds the D3 manufacturer longdesc column'; return 'Adds the D3 manufacturer longdesc column';
} }
public function up(Schema $schema) : void public function up(Schema $schema): void
{ {
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); $this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
$this->d3AddLongdescColumnToOxmanufacturers($schema); $this->d3AddLongdescColumnToOxmanufacturers($schema);
} }
public function down(Schema $schema) : void public function down(Schema $schema): void
{} {
}
/** /**
* @param Schema $schema * @param Schema $schema
* @return void * @return void
* @throws \Doctrine\DBAL\Schema\SchemaException * @throws \Doctrine\DBAL\Schema\SchemaException
*/ */
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema){ public function d3AddLongdescColumnToOxmanufacturers(Schema $schema)
$table = !$schema->hasTable('oxmanufacturers') ? {
$schema->createTable('oxmanufacturers') : $table = !$schema->hasTable('oxmanufacturers') ?
$schema->getTable('oxmanufacturers'); $schema->createTable('oxmanufacturers') :
$schema->getTable('oxmanufacturers');
// Beschreibung // Beschreibung
if (!$table->hasColumn('D3DESCRIPTION')) { if (!$table->hasColumn('D3DESCRIPTION')) {
$table->addColumn('D3DESCRIPTION', (new TextType())->getName()) $table->addColumn('D3DESCRIPTION', (new TextType())->getName())
->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT) ->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT)
->setNotnull(true); ->setNotnull(true);
} }
} }
} }

View File

@ -1,5 +1,18 @@
<?php <?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1); declare(strict_types=1);
namespace D3\ManufacturerInformation\Migrations; namespace D3\ManufacturerInformation\Migrations;
@ -13,50 +26,52 @@ use Doctrine\Migrations\AbstractMigration;
*/ */
final class Version20241028172608 extends AbstractMigration final class Version20241028172608 extends AbstractMigration
{ {
public function getDescription() : string public function getDescription(): string
{ {
return 'Adds multilang tables for the D3 manufacturer longdesc'; return 'Adds multilang tables for the D3 manufacturer longdesc';
} }
public function up(Schema $schema) : void public function up(Schema $schema): void
{ {
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); $this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
$this->d3AddLongdescMultilangColumnsToOxmanufacturers($schema); $this->d3AddLongdescMultilangColumnsToOxmanufacturers($schema);
} }
public function down(Schema $schema) : void public function down(Schema $schema): void
{} {
}
/** /**
* @param Schema $schema * @param Schema $schema
* @return void * @return void
* @throws \Doctrine\DBAL\Schema\SchemaException * @throws \Doctrine\DBAL\Schema\SchemaException
*/ */
public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema){ public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema)
$table = !$schema->hasTable('oxmanufacturers') ? {
$schema->createTable('oxmanufacturers') : $table = !$schema->hasTable('oxmanufacturers') ?
$schema->getTable('oxmanufacturers'); $schema->createTable('oxmanufacturers') :
$schema->getTable('oxmanufacturers');
// lang 1 // lang 1
if (!$table->hasColumn('D3DESCRIPTION_1')) { if (!$table->hasColumn('D3DESCRIPTION_1')) {
$table->addColumn('D3DESCRIPTION_1', (new TextType())->getName()) $table->addColumn('D3DESCRIPTION_1', (new TextType())->getName())
->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT) ->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT)
->setNotnull(true); ->setNotnull(true);
} }
// lang 2 // lang 2
if (!$table->hasColumn('D3DESCRIPTION_2')) { if (!$table->hasColumn('D3DESCRIPTION_2')) {
$table->addColumn('D3DESCRIPTION_2', (new TextType())->getName()) $table->addColumn('D3DESCRIPTION_2', (new TextType())->getName())
->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT) ->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT)
->setNotnull(true); ->setNotnull(true);
} }
// lang 3 // lang 3
if (!$table->hasColumn('D3DESCRIPTION_3')) { if (!$table->hasColumn('D3DESCRIPTION_3')) {
$table->addColumn('D3DESCRIPTION_3', (new TextType())->getName()) $table->addColumn('D3DESCRIPTION_3', (new TextType())->getName())
->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT) ->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT)
->setNotnull(true); ->setNotnull(true);
} }
} }
} }