Skip to content

Instantly share code, notes, and snippets.

@shahariaazam
Created February 11, 2015 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahariaazam/707d863dcaaa65247faf to your computer and use it in GitHub Desktop.
Save shahariaazam/707d863dcaaa65247faf to your computer and use it in GitHub Desktop.
ERP class diagram to solve real life OOP case
<?php
class Erp
{
public function init($login)
{
//Which module
}
public function create($data)
{
}
public function read($id)
{
}
public function update($id, $data)
{
}
public function delete($id)
{
}
}
class Module
{
//Will apply some rules to load any specific module. Turn off, turn on any specific module to load
public function load($module)
{
}
}
class Sales
{
//Basic sales configuration will be here like which sub modules will be loaded. Sales managers info, etc...
}
class Customer extends Sales
{
//All customer related operation means read, write data from ERP class
}
class Billing extends Sales
{
//All billing operation means read, write data from ERP class
}
/**
* ERP is the main class that can perform CRUD after init it
*
* Module => ERP has many modules. We will have to choose one module at a time. i.e: Sales, HR, etc...
*
* Sales module has more 2 sub-module like Customer, Billing, etcc....
*
*
*
* Now suppose I want to do a read operation on Customer Submodule like this way
*
* $data = Erp->init()->Sales()->Customer()->read(1);
*
* or what can be a the best practice?
*
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment