Codeception / Codeception/module-doctrine

How to use Doctrine Module with Relations?

Offen
#23 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
4
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

#### What are you trying to achieve?
i would like to add a product with a related category.
```
$category = [
'id' => 'CATEGORY_ID',
'title' => 'Test Category',
];

$product = [
'id' => 'PRODUCT_ID',
'title' => 'My Test Product',
'category' => 'CATEGORY_ID',
];
$I->haveInRepository('Entity\Category', $category);
$I->haveInRepository('Entity\Product', $product);
```
#### What do you get instead?
setting `category` to a string ` [Doctrine\ORM\ORMInvalidArgumentException] Expected value of type "Entity\Category" for...`
using `categoryID` as key leads to a category set to null (using propel before doctrine, i thought that this might work).

in general it sould be documented that invalid fields are dropped. i think this should throw an exception (should this go into different ticket?).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.