【发布时间】:2021-09-27 04:35:33
【问题描述】:
上下文
我正在尝试更改产品名称属性的约束并将字段长度增加到 300 个字符。
问题
在src/PrestaShopBundle/Form/Admin/Product/ProductInformation.php,我可以改:
->add('name', TranslateType::class, [
'type' => FormType\TextType::class,
'options' => [
'constraints' => [
new Assert\Regex([
'pattern' => '/[<>;=#{}]/',
'match' => false,
]),
new Assert\NotBlank(),
new Assert\Length(['min' => 3, 'max' => 128]),
],
],
])
到
->add('name', TranslateType::class, [
'type' => FormType\TextType::class,
'options' => [
'constraints' => [
new Assert\Regex([
'pattern' => '/[<>;=#{}]/',
'match' => false,
]),
new Assert\NotBlank(),
new Assert\Length(['min' => 3, 'max' => 300]),
],
],
])
而且.. 它有效。但是如果 PrestaShop 更新会发生什么。我需要一种更优雅的方式来做到这一点。
更新#1
官方 PrestaShop Github 存储库中有 PR。我正在等待答案:https://github.com/PrestaShop/PrestaShop/issues/23977
【问题讨论】:
-
类似
Services的东西? devdocs.prestashop.com/1.7/modules/concepts/services
标签: symfony prestashop symfony4 prestashop-1.7