Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WhereCustomizerがPostgreSQLでエラー #6113

Open
tao-s opened this issue Mar 11, 2024 · 3 comments
Open

WhereCustomizerがPostgreSQLでエラー #6113

tao-s opened this issue Mar 11, 2024 · 3 comments
Milestone

Comments

@tao-s
Copy link
Contributor

tao-s commented Mar 11, 2024

概要(Overview)

#2285
追加した携帯電話番号カラムを検索に含めようとすると、PostgreSQLだと下記エラーが出て実行できない。どうもDoctrineのバグっぽい

An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
SQLSTATE[22003]: Numeric value out of range: 7 ERROR: value "09018829619" is out of range for type integer CONTEXT: unnamed portal parameter $1 = '...'

サンプルコード

OrderEntityにはmobile_phoneをstringで追加済み

    /**
     * @ORM\Column(name="mobile_phone", type="string", nullable=true)
     */
    public $mobile_phone;
<?php
namespace Customize\Repository;

use Eccube\Doctrine\Query\WhereClause;
use Eccube\Doctrine\Query\WhereCustomizer;
use Eccube\Repository\QueryKey;

class AdminOrderListCustomizer extends WhereCustomizer
{
    /**
     * キーワード検索に携帯番号を追加。
     *
     * @param array $params
     * @param $queryKey
     * @return WhereClause[]
     */
    protected function createStatements($params, $queryKey)
    {
        return [WhereClause::like('o.mobile_phone', ':multi', ['multi' => $params['multi']])];
    }

    /**
     * OrderRepository::getQueryBuilderBySearchDataForAdmin に適用する.
     *
     * @return string
     * @see \Eccube\Repository\OrderRepository::getQueryBuilderBySearchDataForAdmin()
     * @see QueryKey
     */
    public function getQueryKey()
    {
        return QueryKey::ORDER_SEARCH_ADMIN;
    }
}

再現手順(Procedure)

  1. traitを使ってOrderEntityに携帯番号カラムを追加
  2. 上記のカスタマイザーを追加
  3. 管理画面の受注検索でキーワードに携帯番号を入れて検索

環境(Environment)

EC-CUBE: 4.2.1
PostgreSQL 14.11
PHP 8.1.2
doctrine/dbal 3.7.2

@tao-s tao-s added the bug label Mar 11, 2024
@dotani1111 dotani1111 added this to the 4.3.0 milestone Mar 18, 2024
@dotani1111
Copy link
Contributor

@tao-s
issueありがとうございます。
こちらでも調査を進めたいと思います。
Doctrinのバグとの事ですが、参考リンクなどありますでしょうか?

@tao-s
Copy link
Contributor Author

tao-s commented Apr 12, 2024

@dotani1111 すいません、該当のページがどこだかわからなくなってしまいました... なんかpostgresqlの時だけ発生するみたいな記述でした

@ji-eunsoo
Copy link
Contributor

@tao-s
ありがとうございます。こちらでも再現確認してみます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants