Skip to content

Instantly share code, notes, and snippets.

@peterjmit
Last active December 25, 2015 19:39
Show Gist options
  • Save peterjmit/7029437 to your computer and use it in GitHub Desktop.
Save peterjmit/7029437 to your computer and use it in GitHub Desktop.

Revisions

  1. peterjmit revised this gist Oct 17, 2013. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions TranslatableEntity.orm.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    Entity\TranslatableEntity:
    type: entity
    gedmo:
    translation:
    entity: Entity\Translation
    id:
    id:
    type: integer

    fields:
    some_array_data:
    type: array
    gedmo:
    - translatable

    oneToMany:
    translations:
    targetEntity: Entity\Translation
    mappedBy: object
    cascade: [ persist, remove ]
  2. peterjmit created this gist Oct 17, 2013.
    17 changes: 17 additions & 0 deletions Translation.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    <?php

    namespace Entity;

    use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;

    class Translation extends AbstractPersonalTranslation
    {
    public function setContent($value)
    {
    if (is_array($value)) {
    $value = serialize($value);
    }

    return parent::setContent($value);
    }
    }