composer require pvsaintpe/ltree-bundle
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Entity;
use LTree\Annotation\LTreeChilds;
use LTree\Annotation\LTreeEntity;
use LTree\Annotation\LTreeParent;
use LTree\Annotation\LTreePath;
use LTree\Repository\LTreeEntityInterface;
/**
@LTreeEntity() */ class TestEntity implements LTreeEntityInterface { /**
/**
/**
/**
/**
use Doctrine\ORM\EntityManagerInterface;
use LTree\Repository\LTreeEntityRepository;
/**
Create Extension via migration
public function up(Schema $schema) : void
{
$this->addSql('CREATE IF NOT EXISTS EXTENSION ltree');
}
...
Configure Doctrine Type via config (packages/doctrine.yaml):
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
types:
ltree: LTree\Types\LTreeType
Configure Bundle via config (bundles.php):
LTree\LTreeExtensionBundle::class => ['all' => true],