question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Serialize Field not managed by Doctrine

See original GitHub issue

I have

    /**
     * @var int
     *
     * @ORM\Column(type="integer")
     *
     * @Groups({"read"})
     */
    private $productId;

    /**
     * @var string
     *
     * @ORM\Column(type="string")
     *
     * @Groups({"read"})
     */
    private $productSource;

And then in below

    /**
     * @var ProductInterface
     */
    private $product;

The $product is dynamically depending on the object that stored by $productId and $productSource (currently i use doctrine subscriber to set it and not use doctrine inheritance mapping for many reason).

The $product is set and the object is already there. But i have an error like

"No resource found for object of type ..."

How to solve it or do you have a clue to solve it?

Thanks before

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ad3ncommented, Jan 10, 2017

@teohhanhui : hi, you can try

https://github.com/ad3n/ApiPlatformTest

to check

I use

@ApiResource(attributes={
 *     "normalization_context"={"groups"={"read"}}
 * })

to ignore that error but it is not solution that i want, because the object is already mapped by api platform.

You can check entity ShoppingCart, ShoppingCartItem and Transaction

0reactions
ad3ncommented, Jul 3, 2017

@Simperfit : The problem is coming from my connection pool… I use multiple connection through Api Platform and that is problem when use different entity manager to manage entity between read and write…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to manage deserialized entities with entity manager?
So the solution is to loop the Order::$items array and merge each item individually. Then a new order will be created and connected...
Read more >
The Problem with JsonSerializable and Doctrine when ...
Making your classes JsonSerializable is a wonderful way of serializing your object using nothing but PHP internals. This is really useful for classes...
Read more >
Working with Objects
When EntityManager#clear() is invoked, all entities that are currently managed by the EntityManager instance become detached. When serializing an entity.
Read more >
Databases and the Doctrine ORM
Run php bin/console list doctrine to see a full list. ... This is usually done with attributes: the #[ORM\Column(...)] comments that you see...
Read more >
Working with Entity Manager | MikroORM
To understand flush , lets first define what managed entity is: An entity ... Another use case is serialization, we can use the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found