This topic contains 1 reply, has 2 voices, and was last updated by Mike Kudelya 7 years, 1 month ago.
- Topic
Hi all!
When I try to create new template in System/Emails/Templates I don’t saw my field “salutation“, because it have custom type.
PeopleBundle\Entity\Person
12345678910111213/*** @var string** @ORM\Column(name="salutation", type="salutation", nullable=true)* @ConfigField(* defaultValues={* "dataaudit"={* "auditable"=false* }* }* )*/private $salutation;PeopleBundle\PeopleBundle
1234567891011121314151617181920<?phpnamespace PeopleBundle;use Doctrine\DBAL\Types\Type;use Symfony\Component\HttpKernel\Bundle\Bundle;class PeopleBundle extends Bundle{public function boot(){$em = $this->container->get('doctrine.orm.entity_manager');$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');if (!Type::hasType('salutation')) {Type::addType('salutation', 'PeopleBundle\DBAL\Type\Salutation');$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('salutation', 'salutation');}}}PeopleBundle\DBAL\Type\Salutation
12345678910111213141516171819202122232425262728<?phpnamespace PeopleBundle\DBAL\Type;class Salutation extends Enum{const MR = 'Mr.';const MS = 'Ms.';const KHUN = 'Khun';const MRS = 'Mrs.';const DR = 'Dr.';const PROF = 'Prof.';/** @var array */protected static $choices = [self::MR,self::MS,self::KHUN,self::MRS,self::DR,self::PROF];/** @var string */protected $name = 'salutation';/** @var bool */protected $nullAllowed = true;}How to add my field with custom type?
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.