I am trying to translate the slug of a BlogPost in multiple languages. I decided to use KnpLabs/DoctrineBehaviors to help me with the task. I installed the bundle, got the sluggable behaviour to work in minutes. However, when I add the translatable behaviour, I get can't update my schema.
I get the following error when I try to update my database schema (I know that the --force is not on the picture, but it does the same result).
Here's my BlogPost Entity :
namespace MyProject\MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
/**
* @ORM\Entity
*/
class BlogPost
{
use ORMBehaviors\Sluggable\Sluggable,
ORMBehaviors\Translatable\Translation;
/**
* @ORM\Column(type="string")
*/
protected $title;
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getSluggableFields()
{
return [ 'title' ];
}
}
And here's my BlogPostTranslation entity :
namespace MyProject\MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
use ORMBehaviors\Translatable\Translation;
/**
* @ORM\Entity
*/
class BlogPostTranslation
{
use ORMBehaviors\Translatable\Translation;
/**
* @ORM\Column(type="string", length=255)
*/
protected $name;
/**
* @ORM\Column(type="string")
*/
protected $title;
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
}
I did some debugging with doctrine and the "TargetEntity" is really looking for a folder "Enti". This only occur if I add the translatable behaviour. If I remove it, I can update and use the sluggable behaviour without any problem.