Yeah but it could be a helper method that wraps the call to getAuthor in order 
to return author name.

Marco Pivetta <[email protected]> wrote:

That's conceptually wrong. You first get the author, then his name. You
don't call `getAuthorName` on a book.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 7 April 2013 00:10, sinimix [via Zend Framework Community] <
[email protected]> wrote:

> Hi,
>
> I'm using DataMapper pattern and want to access data of one entity from
> another entity related to each other.
>
> Let's say that there are two entities Book and Author, linked via
> author_id.
>
>
> AuthorEntity
> ------
> id
> name
> --
> get/setId()
> get/setName()
>
>
> BookEntity
> ----------
> id
> name
> author_id
> ---
> get/setId()
> get/setName()
> get/setAuthorId()
>
>
> I want to get author name from BookEntity, e.g. $book->getAuthorName(),
> but I'm not sure where and how to start from. Any suggestion?
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/ZF2-How-to-get-data-from-related-entity-tp4659642.html
>  To start a new topic under Zend Framework, email
> [email protected]
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Re-ZF2-How-to-get-data-from-related-entity-tp4659643.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to