I already use Zend_Db_Table, no matter with it, thank you  :)

But in a more advanced way of using ZF for developping web application, soon or later, some components like automatic datagrids or automatic forms will emerge.
And that's not the only reason.
If you think about it, in most cases, a web application consists in manipulating datas from user to database, and from database to user. But database is not the only data connector in the scene. I think about xml, rss, php arrays, csv files, etc...

And for each of these collectors, the process is the same : user->collector data, and collector data -> user

So what about unifying all of this mess ?
Every collector might be accessed lonely with its own singularity, but all of them can be accessed in a unique pre-formatted way.

If you take my "news" example, i have to implement two very differents class, depending of they came from database, or rss.
And i'm not talking about manage them in a datagrid.

I have choosen "Zend_Data" for naming it, because it was the first idea which came to me. Perhaps another world may be better, but what's important is to understand the concept.

It's the same goal than Zend_Db with its factorised adapters, instead that it works with other datas collectors. And you can find real examples in some PEAR components, where a class take a "source" data component of any kind, treats it, and render it in a "renderer" data component.

Do you more understand what i mean ?


Hello nerVo,

I'm not sure I understand what you mean, but I think Zend_Db_Table is the thing you should be looking at. Zend_Db_Table is a TableModule for the Zend Framework. It connects to your database via Zend_Db_Adapter, examines a table for its schema, then aids you in manipulating and fetching rows from that table.

I also believe that there's an XML adapter.

Using your sample code you could do:

class News extends Zend_Db_Table
{}

|$news = new News();

$data = array(
   'title' => 'Foo',
   'body'  => 'bar'
)

$id = $news->insert($data);

"Data" is a much too broad subject, which I don't think we should be wrapping in a Zend_Data class ... I'd rather use standard PHP functions for "data handling".

Best regards,


|

------------------------------------------------------------------------

Gecontroleerd op virussen door de JOJO Secure Gateway.

Reply via email to