I have product
and product_detail
tables in database.
Every product has a product detail.
class Product
{
/**
* @var ProductDetail
* @JMS\ReadOnly()
* @ORM\OneToOne(targetEntity="ApiBundle\Entity\ProductDetail", mappedBy="product", cascade={"persist"})
* @JMS\Inline()
*/
private $detail;
}
I use @JMS\Inline() annotation to show only detail information of product_detail table. But when I serialize a product I get wrong id. It must be product id but id returns an product detail id. Is it bug or I am doing something wrong?
Source: https://github.com/schmittjoh/JMSSerializerBundle/issues/460#issuecomment-113440743