We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid generation where expresion sql when Type in use SQLConversion (convertToPHPValueSQL, convertToDatabaseValueSQL)
where expresion
Type
convertToPHPValueSQL
convertToDatabaseValueSQL
final class EncryptedType extends BlobType { public const NAME = 'encrypted'; public function getName(): string { return self::NAME; } private function getSecret(): string { return EncryptedKey::getKey(); } public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform): string { return sprintf('AES_ENCRYPT(%s, \'%s\')', $sqlExpr, $this->getSecret()); } public function convertToPHPValueSQL($sqlExpr, $platform): string { return sprintf('AES_DECRYPT(%s, \'%s\')', $sqlExpr, $this->getSecret()); } public function convertToPHPValue($value, AbstractPlatform $platform) { return $value; } public function requiresSQLCommentHint(AbstractPlatform $platform): bool { return true; } }
/** * @ORM\Table(name="User") * @ORM\Entity */ class User { /** * @ORM\Id * @ORM\Column(name="Usr_Id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ public int $id; /** * @ORM\Column(name="Usr_FirstName", type="encrypted", nullable=false) */ public string $firstName; /** * @ORM\Column(name="Usr_LastName", type="string", nullable=false) */ public string $lastName; /** * @ORM\Column(name="Usr_Created", type="datetime_immutable", nullable=false) */ public DateTimeImmutable $created; /** * @ORM\Column(name="Usr_DOB", type="date_immutable", nullable=false) */ public DateTimeImmutable $dob; public function __construct(string $firstName, string $lastName, DateTimeImmutable $created, DateTimeImmutable $dob) { $this->firstName = $firstName; $this->lastName = $lastName; $this->created = $created; $this->dob = $dob; } }
$result = $entityManager->createQueryBuilder() ->from(User::class, 'user') ->select('user.firstName') ->where('user.firstName like :search') ->setParameter('search', '%testname%') ->getQuery() ->getResult();
SELECT AES_DECRYPT(u0_.Usr_FirstName, 'secretKey') AS Usr_FirstName_0 FROM User u0_ WHERE AES_DECRYPT(u0_.Usr_FirstName, 'secretKey') LIKE '%testname%'
SELECT AES_DECRYPT(u0_.Usr_FirstName, 'secretKey') AS Usr_FirstName_0 FROM User u0_ WHERE u0_.Usr_FirstName LIKE '%testname%'
The text was updated successfully, but these errors were encountered:
Fixed invalid generation 'where expresion' sql when 'Type' in use SQL…
082124a
…Conversion (doctrine#9989)
Does this work in 2.x, and if so, could you provide a test case to help isolate the regression?
Sorry, something went wrong.
No branches or pull requests
Bug Report
Summary
Invalid generation
where expresion
sql whenType
in use SQLConversion (convertToPHPValueSQL
,convertToDatabaseValueSQL
)How to reproduce
Expected behavior
Current behavior
The text was updated successfully, but these errors were encountered: