Book a Demo

Author Topic: PHP: How to implement this simple aggregation  (Read 3380 times)

wmac

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
PHP: How to implement this simple aggregation
« on: May 03, 2004, 11:54:06 pm »
Hello,

What is the best method of implementing below class diagram?



I will appereciate your opinions. Please give small code snippets if possible.

Regards,
Mac


wombat

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: PHP: How to implement this simple aggregation
« Reply #1 on: May 06, 2004, 04:55:16 am »
Hi Mac,

unfortunately PHP doesnt have standard 'Collection' class, so  you have to use array:

class Employee
{
...
}

class Company
{
 var mEmployeeArray = Array();
  function Company()
  {
     $this->mEmployeeArray[0] = new Employee();
  }
}


Does it make sense?