Share » Forums » Developer » ez Publish methodology

ez Publish methodology

ez Publish methodology

Friday 12 August 2005 2:27:04 am - 4 replies

Modified on Friday 12 August 2005 3:27:54 am by Patrick ALLAERT

Author Message

Paul Borgermans

Friday 12 August 2005 10:14:46 am

Patrick

You are right about implementing the logic mainly with the node placements, although object relations may be well suited for your categories. In your explanation, you seem to indicate "forward" and "reverse" relations. If that's the case, related objects are the best way to proceed.

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Patrick ALLAERT

Tuesday 16 August 2005 7:51:55 am

Thanks for your suggestion Paul, I think object relation is effectively the right way to implement direct relation between two objects or when the <i>logic</i> is simple. But in my case (we have more than 60 classes) it is really time consuming to do so...

An order is <b>related</b> to a <i>customer</i> and made of several <i>order_detail</i>'s.
An <i>order_detail</i> is related to a <i>product</i>.
The <i>product</i> is under an object of type <i>company</i>.
And I am under a specific <i>company</i> (only one) because I am a responsible of it.

What I need to do here is: <b>Give me the list of persons that have bought something of my company!</b>

With standards <i>object relations</i> and parent/child relations I have to do this:

1. Retrieve the <i>company</i> (<b>C</b>) I belong to.
2. Retrieve the <i>products</i> (<b>P</b>) of <b>C</b>.
3. Retrieve the <i>order details</i> (<b>OD</b>) having a link with <b>P</b>'s.
4. Retrieve the <i>orders</i> (<b>O</b>) the <b>OD</b>'s belong to.
5. Retrieve the <i>persons</i> (buyer: <b>B</b>) linked with <b>O</b>'s.
6. <b>B</b> is the list I want...

In case I want some stats on <i>orders</i> I will have to repeat step 1 to 4.

In a OO language, I will have a strong <b>class model</b> and several methods like
a) <i>Company::getBuyers()</i>: return a list of persons having bought something of this company.
b) <i>Company::getProducts()</i>: return the list of product of this company.
c) <i>Product::getBuyers()</i>: return a list of persons having bought this product.
d) ...

Where method a) will be built using b) and c)

Still waiting for an eZ Publish OO guru... ;)

Patrick ALLAERT
http://www.dixite.com/
http://users.pandora.be/patrick_allaert/

Gabriel Ambuehl

Tuesday 16 August 2005 9:09:16 am

Sounds like you should write something custom if you have that specific needs. You can still integrate such an extension with ezpublish of course.

(I don't know of any pre made CMS that really does what you're after, BTW).

Visit http://triligon.org

Patrick ALLAERT

Friday 19 August 2005 1:10:25 am

I don't think that creating a business logic (or API) behind classes is a <i>specific need</i>...
I think that for now they are still no <b>best practicies</b> for doing this! Of course when your are creating 3 -> 10 custom classes you may always use fetch's functions. But when you reach more than 60 classes, you just can't!

Maybe this approach may be used:
Creating a set of templates that do some <b>core business logic</b> and other templates for the presentation.

Example:

{include uri='api/company/getProducts.tpl'
         company_id=125
}
{* Looping through results *}
{section loop=$results}
  ...
{/section}

This way I don't worry if products and companies are linked with <b>object relations</b> or <b>parent/child relations</b>!

IMHO, this addresses the most disadvantage of eZ templates, business logic is far to often in the template!

Patrick ALLAERT
http://www.dixite.com/
http://users.pandora.be/patrick_allaert/

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu