Hello!
I have a model called User
in Phalcon that has a variable id
with the annotation @Column(type="integer", nullable=false)
.
If i try to find a User by Id using as param a string, it will try a PDOException instead of autovalidating the expected type.
Example:
$user = User::findFirstById('This is a String');
It throws SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer
So, my question is: What is the use of the "type" annotation ? I tought it would automaticaly add type validation before queries.
Also, is there any way for me to add a validation INSIDE THE MODEL that would validate the columns before a SELECT query ?
Thank you