fuel / orm

Fuel PHP Framework - Fuel v1.x ORM
http://fuelphp.com/docs/packages/orm/intro.html
151 stars 95 forks source link

Error since last commit #423

Closed it-can closed 6 years ago

it-can commented 6 years ago

Since updating to the latest version (commit https://github.com/fuel/orm/commit/9f2dc966688ff305c94e798c34442e15e888a83f)

I have this in my model

'created_at' => ['data_type' => 'time_unix'],

I call it like this:

echo $blog->created_at->get_timestamp();

But I now get this error:

Call to a member function get_timestamp() on string

Argument 1 passed to Orm\Observer_Typing::type_time_encode() must be an instance of Fuel\Core\Date, string given
WanWizard commented 6 years ago

Hmm... I thought I tested that. What does $blog->created_at, a numeric unix timestamp?

edit: stupid, some RDBMSes return numbers as strings, so you can't use is_int().

it-can commented 6 years ago

When saving dates (birthdate, etc) I get an encoding error...

TypeError [ Error ]:
Argument 1 passed to Orm\Observer_Typing::type_time_encode() must be an instance of Fuel\Core\Date, string given
WanWizard commented 6 years ago

That means the model property has a data_type "date" or "datetime" which previously weren't supported by Observer_Typing and therefore didn't do anything, but now are.

So you need to remove these from your model.