ZF-300: Zend_Db_Table: map SQL datatypes to PHP native datatypes

Description

Tabe definition: id int(10)
name varchar(255) pass varchar(255) pass_hash_id language_id smallint(5)

on use: $this->_data = $this->find($id);

the php data types can be: $this->id : int $this->name : string $this->pass : string $this->pass_hash_id : int $this->language_id : int

But i don't now whether php can ask all databases for the data types

Greatz

Comments

Changing fix version to 0.8.0.

Hi Marc, I am taking a look at this issue report. I am not understanding what your request is. PHP does not support distinct datatypes corresponding to the different SQL datatypes. What behavior are you asking for, that is different from the behavior today?

Recategorize as Zend_Db_Table component.

Sorry my english is't the best.

If I write a object using Zend_Db_Table i can define which columns have which sql data types. than on get the data from database with e.g. "$this->find($id)" Zend_Db_Table can automatic cast the sql data types to php

e.g. int, smallint ... can cast to integer on php. On now these are string values.

Hi Marc, thank you for your explanation. We may have time to implement this in Zend Framework 0.9.

Please categorize/fix as needed.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Reassigning to Ralph since he's the new maintainer of Zend_Db

Should this be done at the Zend_Db_Table level or perhaps a feature of Zend_Db_Adapter? ALso, should this be an opt-in feature? It seems like explicit casting of every property in a result set might incur quite a cost.

-ralph

The table definition information are needed for this. Therefore it must be done in Zend_Db_Table.

After discussing with several people, it seems like this issue would require several major archtectual changes to be done correctly. I'd like to do this for ZF 2.0, and will be put on the 2.0 roadmap

Reassigned to component maintainer