I’m using DoctrineExtensionsto get sluggable behavior for my entities. One one of my entities I would like to use the city field of the related address entity for the slug. However, I don’t know how to access it:
/**
* @var Foo\SiteBundle\Entity\Address
*
* @ORM\ManyToOne(targetEntity="Foo\SiteBundle\Entity\Address", cascade={"persist"})
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="address_id", referencedColumnName="id")
* })
*/
private $address;
/**
* @Gedmo\Slug(fields={"address->city", "name"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
How can I make this work?
You could perform it: https://github.com/l3pp4rd/DoctrineExtensions/issues/86
But here https://github.com/l3pp4rd/DoctrineExtensions:
Unfortunately this functionnality was removed !
So I think you have to change your logical: for example, you can use a route containing the slug of the address and the current entity and load the entity in response:
Or perhaps a solution, try to set it manually… and automatically with lifecycles, but i’m not sure if it works: