|
Posted by christophe.gosiau on 04/22/07 07:41
Hi Jerry,
My original plan was to to so store Tickets in an array in the Order
object.
But, a ticket needs to be printed (render to pdf). To do that, I need
to know which name I have to print on it (object Customer) and the
event where it is for (object Event).
Both Customer and Event are also stored inside the Order class.
That is the only reason why I need the Order object inside the Ticket
class.
On 22 apr, 04:43, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> christophe.gos...@gmail.com wrote:
> > Hi everybody,
> > I have the following problem:
> > For an application, I made 2 classes: Order and Ticket
> > In the Order object I store an array with Ticket objects.
> > so far so good, now I needed the Order object inside the Ticket class.
> > So I stored a copy of the Order object inside the Ticket class.
>
> > This is what we got until now:
>
> > class Order {
> > pubic tickets = array()
> > }
>
> > class Ticket {
> > public Order = null
> > }
>
> > For both classes I made static methods: get_by_id()
> > Now my question: What happens if i do: Ticket::get_by_id(5);
> > A Ticket object will be created. Inside this Ticket object, an Order
> > object will be created with the Order::get_by_id($this->orderid)
> > method.
> > This Order object will fill his $tickets array wilt the
> > Ticket::get_by_id($ticketid) method.
> > Those tickets will create new Order objects...
> > So there will be a loop.
> > How will php handle this?
> > If this causes an error, is there another solution to fix this
> > problem?
>
> > Christophe
>
> Christophe,
>
> *WHY* do you need a both a list of tickets in orders and an order in ticket?
>
> Either an order has tickets, or a ticket has orders. But can you
> explain how both are true?
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
Navigation:
[Reply to this message]
|