Entity Offer
has parameter which relates to another entity called OfferInvalidPrice
. This entity OfferInvalidPrice
has only one integer parameter - has_invalid_price
. I want this has_invalid_price
parameter to be returned as single parameter instead of the whole invalidPrice
object.
Offer
entity:
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer", options={"unsigned":true})
* @Groups({"regularOffer"})
*/
private $id;
/**
* @ORM\OneToOne(targetEntity=OfferInvalidPrice::class, mappedBy="offer", cascade={"persist", "remove"})
* @Groups({"regularOffer"})
*/
private $invalidPrice;
OfferInvalidPrice
entity:
/**
* @ORM\Id
* @ORM\OneToOne(targetEntity=Offer::class, inversedBy="invalidPrice")
* @ORM\JoinColumn(name="offer_id", referencedColumnName="id")
*/
private $offer;
/**
* @ORM\Column(type="integer", options={"unsigned":true})
* @Groups({"regularOffer"})
*/
private $hasInvalidPrice;
For example if I get the Offer
object it should contain this:
-invalidPrice: 1
instead of:
-invalidPrice: App\Entity\OfferInvalidPrice {#1551
-offer: App\Entity\Offer {#1532}
-hasInvalidPrice: 1
}