[DDC-1144] How insert a AES_ENCRYPT value in a table field Created: 10/May/11  Updated: 10/May/11

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0.4
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: dquintard Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Win XP, MySql5, Php5.3, ZendFramework 1.11.4



 Description   

Hi there,
I'm trying to insert an encrypted data:

Because '"INSERT statements are not allowed in DQL, ...." i processed like this:
<?php
...
// controller
$membre = new \Entity\TMembre();
$membre->setPassword($password);
$em->persist($membre);
$em->flush();
...
?>
//entity
<?php
namespace Entity;
/**

  • TMembre
    *
  • @Table(name="t_membre")
  • @Entity(repositoryClass="Repository\TMembreRepository")
    */
    class TMembre
    {
    /**
  • Set password *
  • @param string $password */
    public function setPassword($password) { $this->email = "AES_ENCRYPT('".$email."','"._MYSQL_CRYPT."')"; => insert this entire string without executing encryption $this->email = new \Doctrine\ORM\Query\Expr\Func("AES_ENCRYPT",array("'".$email."'","'"._MYSQL_CRYPT."'")); => does not work }

    }
    ?>

How can i do ?
Add this method to Doctrine\ORM\Query\Expr class ?

/**
public function aesEncrypt($value)

{ return "AES_ENCRYPT('".$value."','"._MYSQL_CRYPT."')" }

Best regards

David


Generated at Wed Jun 19 15:24:37 UTC 2013 using JIRA 5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5.