AES_ENCRYPT with Doctrine ORM

With thanks to the link above, this code snippet delivers the encrypted value of the password from the database.

$manager=Doctrine_Manager::getInstance();
$conn=Doctrine_Manager::connection('mysql://user:password@localhost/database','doctrine');
$aPasswords=array('password','banana','toast');
foreach ($aPasswords as $password)
{
$salt=mt_rand();
$encrypt = new Doctrine_Expression("AES_ENCRYPT('".htmlspecialchars($password,ENT_QUOTES)."','".$salt."')");
$encrypted_password=$conn->fetchOne('SELECT '.$encrypt,array());
echo 'Password: '.$password.' Salt: '.$salt.' Encrypted Password: '.$encrypted_password.PHP_EOL;
}
exit;