spadefoot / kohana-orm-leap

An ORM module for the Kohana PHP framework that is designed to work with all major databases.
http://spadefoot.github.io/kohana-orm-leap/
100 stars 25 forks source link

unnecessary validate() function call inside DB_ORM_Field class' #50

Closed taai closed 12 years ago

taai commented 12 years ago

Why is the DB_ORM_Field's (all of them) validate() function getting called, if returned value isn't actually being used? Have look: https://github.com/spadefoot/kohana-orm-leap/blob/3.2/master/classes/base/db/orm/field/integer.php#L87 and https://github.com/spadefoot/kohana-orm-leap/blob/3.2/master/classes/base/db/orm/field.php#L114

The returned value isn't being used and it doesn't raise any exception (as at least I would expect) - so what's the point?!

bluesnowman commented 12 years ago

Great catch. I think this was a silly oversight. It should be getting checked. I will work on getting this fixed asap.

taai commented 12 years ago

Yep, now it's fixed. Thanks, Matthew!

taai commented 12 years ago

Bugs!

ErrorException [ Recoverable Error ]: Argument 1 passed to Kohana_Validation_Exception::__construct() must be an instance of Validation, null given

The first argument can't be NULL, it must be Validation. ;)

taai commented 12 years ago

And! Why can't I do like this?

<?php
$car->purchased = DB_SQL::expr('now()');

This gives me that Exception (the buggy one mentioned above).

Maybe this calls for refactoring, no?!