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.
ArrayType and AbstractPersonalTranslation.
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 ]
<?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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment