Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

seeInRepository does not work with values from multiple relations

オープン
#7 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php

調査の方向性

Codeception\Module\Doctrine2::_buildAssociationQuery から始め、2つのリレーションを持つ、示されている Doctor/Ordination のケースを再現します。ネストされた collection が Doctrine QueryException を生成する理由を調査し、その後、seeInRepository が個別の呼び出しを必要とせず複数のリレーション値を受け付けることを確認します。

索引モデルが issue の本文から書いたものです。

説明

Example: a one-to-many relation (uni-directional, so implemented as many-to-many with join table):

    #[ManyToMany(targetEntity: Ordination::class, cascade: ['all'], orphanRemoval: true)]
    private Collection|ArrayCollection $ordinations;

Just for this example I save a Doctor entity with two Ordination relations with haveInRepository in my test.
But then there's no possibility to check for values of both ordinations

        $this->tester->seeInRepository(Doctor::class, [
            'name.firstName' => 'Mauris',
            'ordinations' => [
                [
                    'externalReferenceId' => '3'
                ]
            ]
        ]);

This leads to

 [Doctrine\ORM\Query\QueryException] [Syntax Error] line 0, col 140: Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got '0'

because of the nested structure.
What works is a check for a single relation:

        $this->tester->seeInRepository(Doctor::class, [
            'name.firstName' => 'Mauris',
            'ordinations' => [
                'externalReferenceId' => '3'
            ]
        ]);

(so as a workaround, I could call the seeInRepository multiple times with a different relation's values …)

The problem is in the method \Codeception\Module\Doctrine2::_buildAssociationQuery
but I'm not really sure how to fix this for a PR. Anyone with more knowledge on this?

I guess this issue is somehow related to Codeception/module-doctrine#16

主要言語
PHP
スター
4
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Codeception/module-doctrine のほかの issue

Codeception/module-doctrine の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。