<?php

namespace lib\Services;

use lib\Entities\MemberEntity as Entity;
use lib\Models\MemberModel as Model;

class MemberService extends CommonService
{
  private ?Model $_model = null;
  public function __construct()
  {
    parent::__construct();
  }
  final public function getClassName(): string
  {
    return "Member";
  }
  final public function getClassPath(): string
  {
    return $this->getClassName();
  }
  public function getModel(): Model
  {
    if ($this->_model === null) {
      $this->_model = new Model();
      // $this->_model->setDebug(true);
    }
    return $this->_model;
  }
  public function getEntitById(string $id): Entity
  {
    $this->getModel()->where($this->getModel()->getPKField(), $id);
    return $this->getModel()->getEntity();
  }
}
