This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle::class => ['all' => true], | |
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | |
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], | |
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], | |
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], | |
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], | |
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$entityManager = $this->getDoctrine()->getManager(); | |
$product = new \App\Entity\Product(); | |
$product->setId(1000); | |
$product->setPrice(1000); | |
$product->translate('de')->setName('Schuhe'); | |
$product->translate('de')->setDescription('Schuhe'); | |
$product->translate('en')->setName('Shoes'); | |
$product->translate('en')->setDescription('Shoes'); | |
$entityManager->persist($product); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table product | |
( | |
id INTEGER not null | |
primary key, | |
price INTEGER not null | |
); | |
create table product_translation | |
( | |
id INTEGER not null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Repository; | |
use App\Entity\Product; | |
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |
use Symfony\Bridge\Doctrine\RegistryInterface; | |
/** | |
* @method Product|null find($id, $lockMode = null, $lockVersion = null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Knp\DoctrineBehaviors\Model as ORMBehaviors; | |
/** | |
* @ORM\Entity | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository") | |
*/ | |
class Product | |
{ | |
use ORMBehaviors\Translatable\Translatable; | |
/** | |
* @ORM\Id() | |
* @ORM\GeneratedValue(strategy="NONE") | |
* @ORM\Column(type="integer") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle::class => ['all' => true], | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Locale::setDefault('el'); | |
$countries = Intl::getRegionBundle()->getCountryNames(); | |
// array('SH' => 'Αγία Ελένη', 'LC' => 'Αγία Λουκία', ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Locale::setDefault('el'); | |
$allCurrencies = Intl::getCurrencyBundle()->getCurrencyNames(); | |
// array('ALK' => 'Albanian Lek (1946–1965)', 'AOR' => 'Angolan Readjusted Kwanza (1995–1999)', ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Locale::setDefault('el'); | |
$allLocales = Intl::getLocaleBundle()->getLocaleNames(); | |
// array('en' => 'Αγγλικά', 'en_SH' => 'Αγγλικά (Αγία Ελένη)', ...) |