Skip to content

Instantly share code, notes, and snippets.

View theodesp's full-sized avatar
🦄
Jumping over Rainbows...

Theofanis Despoudis theodesp

🦄
Jumping over Rainbows...
View GitHub Profile
<?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],
$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);
create table product
(
id INTEGER not null
primary key,
price INTEGER not null
);
create table product_translation
(
id INTEGER not null
<?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)
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
/**
* @ORM\Entity
*/
/**
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
*/
class Product
{
use ORMBehaviors\Translatable\Translatable;
/**
* @ORM\Id()
* @ORM\GeneratedValue(strategy="NONE")
* @ORM\Column(type="integer")
<?php
return [
Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle::class => ['all' => true],
...
Locale::setDefault('el');
$countries = Intl::getRegionBundle()->getCountryNames();
// array('SH' => 'Αγία Ελένη', 'LC' => 'Αγία Λουκία', ...)
Locale::setDefault('el');
$allCurrencies = Intl::getCurrencyBundle()->getCurrencyNames();
// array('ALK' => 'Albanian Lek (1946–1965)', 'AOR' => 'Angolan Readjusted Kwanza (1995–1999)', ...)
Locale::setDefault('el');
$allLocales = Intl::getLocaleBundle()->getLocaleNames();
// array('en' => 'Αγγλικά', 'en_SH' => 'Αγγλικά (Αγία Ελένη)', ...)