oop

questions regarding implement composition in php from UML  #angularjs #reactjs

  • Store class contains below varibles in selected store own a one or more items to sell.
  • in item class some methods can access without using id of the item
  • or is there any other way to store item details and access item class methods inside the store class
  • in store class some methods can access without using id of the store
  • actually without id both store object,item object has no meaning in the system

one store own a one or more items to sell.
without a store there is no existence for items.
it means in the class diagram
store class and item class has composition relationship

@ng_real_ninja: questions regarding implement composition in php from UML #angularjs #reactjs

I’m creating a ebay like web site.

system have stores. and inside those stores there are items to sell.

one store own a one or more items to sell. without a store there is no existence for items. it means in the class diagram store class and item class has composition relationship

class diagram shown below

database table structure

i want to implement this in php code

in here both classes are in same file and some methods are not implemented because of simplicity.

this is sample code

store class contains below varibles

variable as a array of DTO’s

used only for create object of the item class

variable is create only for access methods in item class, inside the store class

or is there any other way to store item details and access item class methods inside the store class

in store class some methods can access without using id of the store

in item class some methods can access without using id of the item

actually without id both store object,item object has no meaning in the system

what is the solution for this

define above mentioned methods as static methods and access them without creating class object or is there any other ?

oop