-
-
Notifications
You must be signed in to change notification settings - Fork 940
Closed
Description
Hello all,
I do have 2 Entity who one include the other one with the @Orm\embeddable functionality .
Since the version 2.1 of the api platform, it doesn't seems to work.
I have the main Entity
/**
* @ApiResource(
* attributes={
* "jsonld_embed_context"=true,
* "normalization_context"={"groups"={"g1"}},
* "denormalization_context"={"groups"={"g1"}}
* })
* @ORM\Entity
*/
class Foo
{
/**
* @var int The entity Id
*
* @ORM\Id
* @ORM\Column(type="integer", name="content_type")
*/
private $id;
/**
* @var string Something else
*
* @ORM\Column
* @Groups({"g1"})
*/
private $bar = '';
/**
* @var Suub Other Structured Infos
* @ORM\Embedded(class = "Suub", columnPrefix = "Suub_")
* @Groups({"g1"})
*/
private $suub;
public function __construct()
{
$this->suub = new Suub();
}
public function setSuub(Suub $suub)
{
$this->suub = $suub;
}
public function getSuub() : Suub
{
return $this->suub;
}
public function getId()
{
return $this->id;
}
public function getBar() : string
{
return $this->bar;
}
public function setBar(string $bar)
{
$this->bar = $bar;
}
}The Embeddable entity
namespace AppBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups as Groups;
/**
* @ORM\Embeddable
* @ApiResource()
*/
class Suub
{
/**
* @var string Something else
* @ORM\Column
* @Groups({"g1"})
*/
private $bar = '';
public function getBar() : string
{
return $this->bar;
}
public function setBar(string $bar)
{
$this->bar = $bar;
}
}It looks like it's all correct:
[
{
"bar": "string",
"suub": {
"bar": "string"
}
}
]But since 2.1 I get this error:
Unable to generate an IRI for the item of type \"AppBundle\\Entity\\Suub\"
I'm doing this because I need to have a certain Json structure and not having N tables with 1..1 relations. If you have any other idea I'm all ears.
blaues0cke
Metadata
Metadata
Assignees
Labels
No labels