PHP code example of combodo / doctrine-encrypt-bundle
1. Go to this page and download the library: Download combodo/doctrine-encrypt-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
combodo / doctrine-encrypt-bundle example snippets
/**
* @var string
* @ORM\Column(name="host", type="string", length=255)
* @Encrypted
*/
private $host;
/** @var string store the decryptedVersion of $host */
private $hostDecrypted;
/**
* Set host
*
* You MUST assign null to the decryped var
*
*
* @param string $host
*
* @return ItopUser
*/
public function setHost($host)
{
$this->host = $host;
$this->hostDecrypted = null;//mandatory if you want your host to be encoded again!
return $this;
}
/**
* Get host
*
* You MUST return the decryped var if it is set
*
* @return string
*/
public function getHost()
{
if (!empty($this->hostDecrypted)) {
return $this->hostDecrypted;
}
return $this->host;
}
/**
* INTERNAL
* Set hostDecrypted
*
* @param string $host
*
* @return ItopUser
*/
public function setHostDecrypted($hostDecrypted)
{
$this->hostDecrypted = $hostDecrypted;
return $this;
}
/**
* INTERNAL
* Get hostDecrypted
*
* @return string
*/
public function getHostDecrypted()
{
return $this->hostDecrypted;
}