I need to map an entity to a Postgres view which doesn't have primary id, no id defined.
Views in Postgresql can't have primary keys. On the same time Doctrine entities need a primary key defined.
Can I create a "virtual" property some like this?
class MyEntityClass
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="uuid")
*/
private $id;
public function getId(): string
{
return generate_unique_id_just_for_my_join()
}
}
This entity need to be used only for select data. Never for insert/update.