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

How to use Doctrine Module with Relations? #23

Open
c33s opened this issue Jun 1, 2017 · 2 comments
Open

How to use Doctrine Module with Relations? #23

c33s opened this issue Jun 1, 2017 · 2 comments

Comments

@c33s
Copy link

c33s commented Jun 1, 2017

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?).

@DavertMik
Copy link
Member

@c33s
Copy link
Author

c33s commented Jun 3, 2017

i would, if i would know how to do this :)
(the question label would fit in here)

@Naktibalda Naktibalda transferred this issue from Codeception/Codeception Jan 9, 2021
@TavoNiievez TavoNiievez transferred this issue from Codeception/module-doctrine2 Feb 17, 2024
TavoNiievez pushed a commit that referenced this issue Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants