Open
Description
Doctrine 2 has a great feature named as Embeddable classes.
I try to use it in the pair with graphql-doctrine
and got error No type registered with key Position. Either correct the usage, or register it in your custom types container when instantiating GraphQL\Doctrine\Types
, where Position
is a simple object
namespace Stagem\Product\Model\Monitor;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Embeddable
*/
class Position
{
/**
* @ORM\Column(type="integer")
*/
private $line = 1;
/**
* @ORM\Column(type="integer")
*/
private $column = 1;
// ...
}
and RankMonitor
model
namespace Stagem\Product\Model;
use Doctrine\ORM\Mapping as ORM;
use GraphQL\Doctrine\Annotation as API;
use Stagem\Product\Model\Monitor\Position;
/**
* @ORM\Entity()
* @ORM\Table(name="product_rank_monitor")
*/
class RankMonitor
{
/**
* @var int
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer", options={"unsigned":true})
*/
private $id;
/**
* @var Position
* @ORM\Embedded(class="Stagem\Product\Model\Monitor\Position", columnPrefix="position_")
*/
private $position;
// ...
}
Do you plan to add native support for Embeddable
classes or maybe can explain how to implement this feature?