improve code
This commit is contained in:
bovenliggende
c84a109281
commit
77bd789f14
@ -94,8 +94,8 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
|
||||
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
|
||||
$oManufacturer->assign($aParams);
|
||||
|
||||
if (false === is_null($this->d3GetLongdescParamValue($oManufacturer))) {
|
||||
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue($oManufacturer));
|
||||
if (false === is_null($this->d3GetLongdescParamValue())) {
|
||||
$oManufacturer->d3SetLongdesc($this->d3GetLongdescParamValue());
|
||||
$oManufacturer->save();
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetLongdescParamValue(Manufacturer $oManufacturer): string
|
||||
public function d3GetLongdescParamValue(): string
|
||||
{
|
||||
return (string) Registry::getRequest()->getRequestEscapedParameter("editval")['oxmanufacturers__d3description'];
|
||||
}
|
||||
@ -114,13 +114,13 @@ class ManufacturerInfoLongdesc extends AdminDetailsController
|
||||
*
|
||||
* @param $sValue
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
protected function processLongDesc($sValue): mixed
|
||||
protected function processLongDesc($sValue): string
|
||||
{
|
||||
$aSearch = ['&nbsp;', '&', '"', '&lang=', '<p> </p>', '<p> </p>'];
|
||||
$aReplace = [' ', '&', '"', '&lang=', '', ''];
|
||||
|
||||
return str_replace($aSearch, $aReplace, $sValue);
|
||||
return (string) str_replace($aSearch, $aReplace, $sValue);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ declare(strict_types=1);
|
||||
namespace D3\ManufacturerInformation\Modules\Application\Model;
|
||||
|
||||
use D3\ManufacturerInformation\Application\Model\Constants;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Field;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
@ -33,7 +34,7 @@ class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent
|
||||
try {
|
||||
$this->assign([Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME => $sValue]);
|
||||
$this->save();
|
||||
} catch (\Exception $exception) {
|
||||
} catch ( Exception $exception) {
|
||||
Registry::getLogger()->error($exception->getMessage());
|
||||
}
|
||||
}
|
||||
@ -42,9 +43,9 @@ class D3ManufacturerLongDesc extends D3ManufacturerLongDesc_parent
|
||||
}
|
||||
|
||||
/**
|
||||
* @return field
|
||||
* @return Field
|
||||
*/
|
||||
public function d3GetLongdesc(): field
|
||||
public function d3GetLongdesc(): Field
|
||||
{
|
||||
$longName = $this->getFieldLongName(Constants::D3_OXMANUFACTURERS_LONGDESC_FIELDNAME);
|
||||
return $this->$longName ?: oxNew(Field::class);
|
||||
|
@ -20,18 +20,22 @@ namespace D3\ManufacturerInformation\Modules\Application\Model;
|
||||
use OxidEsales\Eshop\Application\Model\Manufacturer;
|
||||
use OxidEsales\Eshop\Core\Field;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\UtilsView;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class ManufacturerInfoList extends ManufacturerInfoList_parent
|
||||
{
|
||||
/**
|
||||
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
|
||||
*
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function addCategoryFields($oManufacturer): void
|
||||
{
|
||||
@ -64,6 +68,11 @@ class ManufacturerInfoList extends ManufacturerInfoList_parent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateRendererInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
private function getRenderer(): TemplateRendererInterface
|
||||
{
|
||||
return ContainerFactory::getInstance()->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
|
||||
|
@ -18,6 +18,7 @@ declare(strict_types=1);
|
||||
namespace D3\ManufacturerInformation\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Schema\SchemaException;
|
||||
use Doctrine\DBAL\Types\TextType;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -45,7 +46,7 @@ final class Version20241023154223 extends AbstractMigration
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @return void
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
* @throws SchemaException
|
||||
*/
|
||||
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema)
|
||||
{
|
||||
|
@ -17,7 +17,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\ManufacturerInformation\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Schema\SchemaException;
|
||||
use Doctrine\DBAL\Types\TextType;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -44,8 +46,10 @@ final class Version20241028172608 extends AbstractMigration
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*
|
||||
* @return void
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
* @throws Exception
|
||||
* @throws SchemaException
|
||||
*/
|
||||
public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema)
|
||||
{
|
||||
|
Laden…
x
Verwijs in nieuw issue
Block a user