Hey iosonogio,

maybe you should read that manual:

http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.select.fetchall

especially the example 10.10. "Using setFetchMode()" would be
interesting for you.

--

On Thu, Jun 26, 2008 at 10:03 PM, iosonogio <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> coming from OO Java programming, I'm getting a little bit disoriented with
> the array usage in PHP... they are almost everywhere and just would like to
> ask and share with you how you handle this.
>
> I have  a very simple application for creating new Articles.
> I have an Article class, with fields, getters and setters.
> I am using Zend_Db as a gateway to database table.
>
> When I need to find an article, I do:
>
> Article::findById(id)
>
> what would you make it return?
> It returns an array with the keys named as the article'fields, and it
> returns an array because the Zend_Db select query does return an array...
> Would you make it return an object? That would mean I have to transform the
> array into an Article class object.
>
>
> When I need to return a list of articles, also I'm returning an array of
> arrays...
> Same problem here, but here I would be fine with arrays since I just want a
> list to  display and have nothing to do onto those list of article.
>
>
> When I have to create and save a new article I do:
>
> $article = new Article()
> $article.save()
>
> Zend_Db insert now expects an array so I do build an array from the article
> object  here to pass to the insert method.
>
> Hope my doubts are clear and not off topic :)
> Thank you for sharing any suggestions or ideas.
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/Object-Oriented-and-dealing-with-array-coming-from-Zend_Db-and-Zend_Form-tp18142182p18142182.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>



-- 
Mit freundlichen Grüßen
With best regards

Wolfgang Forstmeier
-------------------------------------------
+49° 34' 26.76", +11° 0' 48.60"
-------------------------------------------
mailto:[EMAIL PROTECTED]

Reply via email to