You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
namespace ShopBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Translatable\Translatable;
/**
* Shop implements Translatable
*
* @ORM\Table(name="shop")
* @ORM\Entity(repositoryClass="ShopBundle\Repository\ShopRepository")
*/
class Shop
{
/**
* @var string
*
* @Gedmo\Translatable
* @ORM\Column(name="description", type="string", length=255)
*/
private $description;
/**
* @var string
*
* @Gedmo\Locale
*/
private $local;
/**
* Set description
*
* @param string $description
* @return Shop
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set translatable local
*
* @param string $locale
* @return Shop
*/
public function setTranslatableLocale($locale)
{
$this->locale = $locale;
return $this;
}
}
My Fixtures
<?php
namespace GeographyBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use ShopBundle\Entity\Shop;
/**
* Load Shop Data
*/
class LoadShopData extends AbstractFixture implements OrderedFixtureInterface
{
/**
* Load
*
* @param \Doctrine\Common\Persistence\ObjectManager $manager
*/
public function load(ObjectManager $manager)
{
$shop = new Shop();
$shop->setDescription('This is shop 1 !');
$manager->persist($shop);
$manager->flush();
$shop->setTranslatableLocale('fr');
$shop->setDescription("Ceci est le shop 1 !");
$manager->flush();
}
}
Table ext_translation was created on php app/console doctrine:schema:create, but no data was insert on php app/console doctrine:fixtures:load and description field was juste updated on shop table.
What's wrong with my code ?
Thanks for any help.
The text was updated successfully, but these errors were encountered:
Did you try to update the package? Does it happen also outside of the fixture context?
What packages have you installed in composer.json? With version 1.12.0 on Symfony 6.4 and Doctrine ORM 3.2.2 it's working so far (still initial write/read testing).
Hi ! I try to use Doctrine Extension Translatable, but it doesn't work.
So, this is my configuration :
In my composer
In my config.yml
My Shop Class
My Fixtures
Table
ext_translation
was created onphp app/console doctrine:schema:create
, but no data was insert onphp app/console doctrine:fixtures:load
and description field was juste updated onshop
table.What's wrong with my code ?
Thanks for any help.
The text was updated successfully, but these errors were encountered: