30 lines
634 B
PHP
30 lines
634 B
PHP
<?php
|
||
|
||
abstract class BaseEntity
|
||
|
||
{
|
||
protected static $status_error = 0;
|
||
protected static $error_message = [];
|
||
|
||
// Вспомогательные методы для работы с ошибками
|
||
protected function addError($key, $message)
|
||
{
|
||
static::$status_error = 1;
|
||
static::$error_message[$key] = $message;
|
||
}
|
||
|
||
// Получить ошибки
|
||
public function getErrors()
|
||
{
|
||
if (static::$error_message) {
|
||
return [
|
||
'success' => false,
|
||
'errors' => static::$error_message
|
||
];
|
||
}
|
||
return null;
|
||
}
|
||
}
|
||
|
||
|
||
?>
|