I have two entities named 'content' and 'criteredetest' through a oneToMany relation (a content can handle several 'criteredetest'). The entity 'criteredetest' has some fields and two of them are translatables fields
All works like a charm when I create some 'contents' (and attached 'criteresdetest') with symfony fixtures. But when I want to show a 'content' from my browser ( with a twig template ), I get this pretty error :
Here some code of my project :
// the entity 'content'
#[ORM\Entity(repositoryClass: ContentRepository::class)]
class Content implements TranslatableInterface
{
use TranslatableTrait; // I don't know if its important to show this line in this post (the entity 'Content' contains some another field I need to translate (like the title of the content) )
// ...
#[ORM\OneToMany(mappedBy: 'content', targetEntity: Criteredetest::class, cascade: ["persist", "remove"], orphanRemoval: true)]
private Collection $criteresdetest;
// ...
}
// the entity 'criteredetest'
#[ORM\Entity(repositoryClass: CriteredetestRepository::class)]
class Criteredetest implements TranslatableInterface
{
use TranslatableTrait;
// ...
// some fields are defined, but not the fields 'name' and 'description' I need to translate in my app
// use ...
// the entity 'criteredetestTranslation'
#[ORM\Entity(repositoryClass: CriteredetestRepository::class)]
class CriteredetestTranslation implements TranslationInterface
{
use TranslationTrait;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 200, nullable: true)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, length: 200, nullable: true)]
private ?string $description = null;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
}
Did i make a mistake somewhere ?
Thanks for any help !
Hello and thanks firstly for your lib !
I have a similar issue described in this closed post.
I have two entities named 'content' and 'criteredetest' through a oneToMany relation (a content can handle several 'criteredetest'). The entity 'criteredetest' has some fields and two of them are translatables fields
All works like a charm when I create some 'contents' (and attached 'criteresdetest') with symfony fixtures. But when I want to show a 'content' from my browser ( with a twig template ), I get this pretty error :
Here some code of my project :
Did i make a mistake somewhere ? Thanks for any help !