X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fwrapper%2Fclass_CompanyDatabaseWrapper.php;h=3f2ade62de02f73412f05700eef376130a5a0075;hb=968aa514d2df8ed98dab8ff251ee83c95f1ac182;hp=80bb0371954c3adb59b07db9ad763cd4feda9fd5;hpb=6d07e4756efdebbb5d1df9ce2e6784dd5536eeb2;p=shipsimu.git diff --git a/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php b/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php index 80bb037..3f2ade6 100644 --- a/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php +++ b/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php @@ -22,6 +22,11 @@ * along with this program. If not, see . */ class CompanyDatabaseWrapper extends BaseDatabaseWrapper { + /** + * Company instance + */ + private $companyInstance = null; + // Constants for database tables const DB_TABLE_COMPANY_DATA = "company"; const DB_TABLE_COMPANY_USER = "company_user"; @@ -45,15 +50,22 @@ class CompanyDatabaseWrapper extends BaseDatabaseWrapper { /** * Creates an instance of this wrapper class * + * @param $companyInstance An instance of a generic company class or null if no specific * @return $wrapperInstance An instance of this wrapper class + * @todo Find an interface which is suitable for all companies */ - public final static function createCompanyDatabaseWrapper () { + public final static function createCompanyDatabaseWrapper (ShippingCompany $companyInstance = null) { // Create a new instance $wrapperInstance = new CompanyDatabaseWrapper(); // Set (primary!) table name $wrapperInstance->setTableName(self::DB_TABLE_COMPANY_DATA); + // Set the company instance if not null + if (!is_null($companyInstance)) { + $wrapperInstance->setCompanyInstance($companyInstance); + } // END - if + // Return the instance return $wrapperInstance; } @@ -93,6 +105,27 @@ class CompanyDatabaseWrapper extends BaseDatabaseWrapper { // Return the result return $participates; } + + /** + * Setter for company instance + * + * @param $companyInstance An instance of a generic company + * @return void + * @todo Find an interface suitable for all types of companies + */ + protected final function setCompanyInstance (ShippingCompany $companyInstance) { + $this->companyInstance = $companyInstance; + } + + /** + * Getter for company instance + * + * @return $companyInstance An instance of a generic company + * @todo Find an interface suitable for all types of companies + */ + public final function getCompanyInstance () { + return $this->companyInstance; + } } // [EOF]