mrN
mrN

Reputation: 3770

Zend Framework Data Mapper problem

It has been a rough task to learn this framework. I am still stuck at quick start.

I am using PDO_MYSQL as my adapter. I have followed the tutorial to the letters.

At a point, it says to create application/models/GuestbookMapper.php and put the following code

class Application_Model_GuestbookMapper
{
    public function save($model);
    public function find($id, $model);
    public function fetchAll();
}

Then it say to run this command

zf create model GuestbookMapper

The tutorials claims to insert additional methods. But in my case, it emptied the my GuestbookMapper class with this

class Application_Model_GuestbookMapper
{

}

Same goes with another command zf create model Guestbook. It empties the scripts, with just plain class defination.

Please help me !

Upvotes: 1

Views: 978

Answers (2)

leek
leek

Reputation: 12121

Re-read the QuickStart carefully. You're probably skimming and getting hung up.

Here is the text:

A typical API for a data mapper is as follows:

class Application_Model_GuestbookMapper
{
    public function save($model);
    public function find($id, $model);
    public function fetchAll();
}

And then...

In addition to these methods, we'll add methods for setting and retrieving the Table Data Gateway. To create the initial class, use the zf CLI tool:

% zf create model GuestbookMapper

Lastly...

Now, edit the class Application_Model_GuestbookMapper found in application/models/GuestbookMapper.php to read as follows:

Note that the first example is just that - an example. They are providing a sample interface of what your class will probably look like. The second block of text explains how to create your initial (empty) class. And the last block gives you the exact final code of the GuestbookMapper class.

Upvotes: 3

Tomáš Fejfar
Tomáš Fejfar

Reputation: 11217

Just add those methods again ;) Won't that work?

Upvotes: -1

Related Questions