/** * @inheritdoc */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value !== null) { $value = parent::convertToDatabaseValue($value, $platform); } return Encryptor::get()->encrypt($value); }
/** * Boots the Bundle. */ public function boot() { if ($this->container->hasParameter('rafrsr.doctrine.encryptor')) { $encryptor = $this->container->getParameter('rafrsr.doctrine.encryptor'); } else { $encryptor = MCRYPT_RIJNDAEL_256; } if ($this->container->hasParameter('rafrsr.doctrine.secret')) { $secret = $this->container->getParameter('rafrsr.doctrine.secret'); } else { $secret = $this->container->getParameter('secret'); } Encryptor::set(Crypto::build($secret, $encryptor)); }