Untitled
unknown
plain_text
7 months ago
4.2 kB
5
Indexable
<?php
require_once "db.class.php";
require_once "tenant.class.php";
require_once "user.class.php";
require_once "workSession.class.php";
require_once "dailySummary.class.php";
require_once "mail.class.php";
require_once "permission.class.php";
require_once "employeeWageRate.class.php";
require_once "monthReport.class.php";
require_once "commuteLocation.class.php";
require_once "country.class.php";
require_once "jobDepartment.class.php";
require_once "jobPosition.class.php";
require_once "payout.class.php";
class AppContainer
{
private PDO $db;
private ?DB $dbInstance = null;
private ?Tenant $tenant = null;
private ?User $user = null;
private ?WorkSession $workSession = null;
private ?DailySummary $dailySummary = null;
private ?Mail $mail = null;
private ?Permission $permission = null;
private ?EmployeeWageRate $employeeWageRate = null;
private ?MonthReport $monthReport = null;
private ?CommuteLocation $commuteLocation = null;
private ?Country $country = null;
private ?JobDepartment $jobDepartment = null;
private ?JobPosition $jobPosition = null;
private ?Payout $payout = null;
public function __construct()
{
$this->db = (new DB())->getDB();
}
public function getDb(): PDO
{
return $this->db;
}
public function getDbInstance(): DB
{
if (!$this->dbInstance) {
$this->dbInstance = new DB($this);
}
return $this->dbInstance;
}
public function getTenant(): Tenant
{
if (!$this->tenant) {
$this->tenant = new Tenant($this);
}
return $this->tenant;
}
public function getUser(): User
{
if (!$this->user) {
$this->user = new User($this);
}
return $this->user;
}
public function getWorkSession(): WorkSession
{
if (!$this->workSession) {
$this->workSession = new WorkSession($this);
}
return $this->workSession;
}
public function getDailySummary(): DailySummary
{
if (!$this->dailySummary) {
$this->dailySummary = new DailySummary($this);
}
return $this->dailySummary;
}
public function getPermission(): Permission
{
if (!$this->permission) {
$this->permission = new Permission($this);
}
return $this->permission;
}
public function getEmployeeWageRate(): EmployeeWageRate
{
if (!$this->employeeWageRate) {
$this->employeeWageRate = new EmployeeWageRate($this);
}
return $this->employeeWageRate;
}
public function getMonthReport(): MonthReport
{
if (!$this->monthReport) {
$this->monthReport = new MonthReport($this);
}
return $this->monthReport;
}
public function getCommuteLocation(): CommuteLocation
{
if (!$this->commuteLocation) {
$this->commuteLocation = new CommuteLocation($this);
}
return $this->commuteLocation;
}
public function getCountry(): Country
{
if (!$this->country) {
$this->country = new Country($this);
}
return $this->country;
}
public function getJobDepartment(): JobDepartment
{
if (!$this->jobDepartment) {
$this->jobDepartment = new JobDepartment($this);
}
return $this->jobDepartment;
}
public function getJobPosition(): JobPosition
{
if (!$this->jobPosition) {
$this->jobPosition = new JobPosition($this);
}
return $this->jobPosition;
}
public function getPayout(): Payout
{
if (!$this->payout) {
$this->payout = new Payout($this);
}
return $this->payout;
}
public function getMail(): Mail
{
if (!$this->mail) {
$this->mail = new Mail($this);
}
return $this->mail;
}
}
Editor is loading...
Leave a Comment