Skip to content

Latest commit

 

History

History
executable file
·
41 lines (28 loc) · 958 Bytes

usage.md

File metadata and controls

executable file
·
41 lines (28 loc) · 958 Bytes

Usage

Entity

namespace Acme\DemoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

// importing @Encrypted annotation
use Ambta\DoctrineEncryptBundle\Configuration\Encrypted;

/**
 * @ORM\Entity
 * @ORM\Table(name="user")
 */
class User {

    ..

    /**
     * @ORM\Column(type="string", name="email")
     * @Encrypted
     * @var int
     */
    private $email;

    ..

}

It is as simple as that, the field will now be encrypted the first time the users entity gets edited. We keep an prefix to check if data is encrypted or not so, unencrypted data will still work even if the field is encrypted.

Console commands

There are some console commands that can help you encrypt your existing database or change encryption methods. Read more about the database encryption commands provided with this bundle.