I have a database set up (work in progress with currently only two tables: user and email) and integrated with Propel. When registering a user I check to make sure that the email does not already exist (either as a current email in the email table or an original email in the user database).
To do this simply with propel, I use the following:
if(EmailQuery::create()->filterByCurrent(TRUE)->findOneByEmailAddress($email) != NULL) {
// email address being used currently
} else if(UserQuery::create()->findOneByOriginalEmail($email) != NULL) {
// email address claimed on account already
}
The first query works fine, but the second query generates and error: Syntax error: 7 ERROR: syntax error at or near "."
The SQL query generated by Propel looks like the following:
SELECT user.id, user.original_email, user.password, user.accept_terms, user.paid, user.customer_id, user.trial_end, user.created_at, user.updated_at, user.ip_address FROM user WHERE user.original_email=:p1 LIMIT 1
If I copy and paste this into phpPgAdmin, it returns the same error (and points to each . in between user and the column). I am new to PostgreSQL, is there some syntax piece I am missing? All other Propel query builders I have used worked without a hitch.