41 lines
989 B
PHP
41 lines
989 B
PHP
<?php
|
|
|
|
namespace App\Entities;
|
|
|
|
use CodeIgniter\Entity\Entity;
|
|
|
|
abstract class CommonEntity extends Entity
|
|
{
|
|
protected $datamap = [];
|
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
//사용법 : $client->created_at->format('Y-m-d')
|
|
//비교방법 : if ($client->created_at < new \DateTime('2024-01-01')) {
|
|
protected $casts = [];
|
|
|
|
public function __construct(array|null $data = null)
|
|
{
|
|
parent::__construct($data);
|
|
}
|
|
|
|
abstract public function __toString();
|
|
final public function getPK(): string
|
|
{
|
|
$field = constant("static::PK");
|
|
return $this->$field;
|
|
}
|
|
final public function getTitle(): string
|
|
{
|
|
$field = constant("static::Title");
|
|
return $this->$field;
|
|
}
|
|
final public function getUpdatedAt(): string
|
|
{
|
|
return $this->created_at;
|
|
}
|
|
final public function getCreatedAt(): string
|
|
{
|
|
return $this->created_at;
|
|
}
|
|
//공통부분
|
|
}
|