- WIP on ApiRenderer and Save Form context@
This commit is contained in:
1 parent
78670c2fcf
commit
e51d1ea7a3
4 files changed
+107
-18
No files matched your search
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Lean\Api\Entity;
|
||||
|
||||
use Lean\Api\Attribute\EntityField;
|
||||
use Ulmus\EntityTrait,
|
||||
Ulmus\SearchRequest\SearchableInterface,
|
||||
Ulmus\SearchRequest\SearchRequestInterface,
|
||||
Ulmus\Entity\Field\Datetime;
|
||||
|
||||
use Ulmus\{Attribute\Obj\Table,
|
||||
Entity\EntityInterface};
|
||||
|
||||
use Ulmus\{Api\Common\MethodEnum,
|
||||
SearchRequest,
|
||||
SearchRequest\Attribute\PropertyValueModifier\Split,
|
||||
SearchRequest\Attribute\PropertyValueSource,
|
||||
SearchRequest\Attribute\SearchOrderBy,
|
||||
SearchRequest\Attribute\SearchWhere,
|
||||
SearchRequest\SearchMethodEnum};
|
||||
|
||||
use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual, Where};
|
||||
|
||||
#[Table(name: "debug_errors", adapter: "lean.api")]
|
||||
class Error implements EntityInterface, \JsonSerializable {
|
||||
use EntityTrait;
|
||||
|
||||
#[Field\Id]
|
||||
public int $id;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "URL from which the error occurred")]
|
||||
public string $url;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "HTTP method", field: "httpMethod")]
|
||||
public MethodEnum $method;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "Error message")]
|
||||
public string $message;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "Error code")]
|
||||
public int $code;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "File from which the error occurred")]
|
||||
public string $file;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "Line in the file from which the error occurred")]
|
||||
public int $line;
|
||||
|
||||
#[Field]
|
||||
#[EntityField(description: "Stack trace of the exception")]
|
||||
public array $trace;
|
||||
|
||||
#[Field\CreatedAt(name: "created_at")]
|
||||
public Datetime $createdAt;
|
||||
|
||||
public function __toString() {
|
||||
return mb_strlen($this->message) > 255 ? mb_substr($this->message, 0, 255) . "[...]" : $this->message;
|
||||
}
|
||||
|
||||
public static function searchRequest(...$arguments) : SearchRequestInterface
|
||||
{
|
||||
return new #[SearchRequest\Attribute\SearchRequestParameter(Error::class)] class(...$arguments) extends SearchRequest\SearchRequest {
|
||||
#[SearchRequest\Attribute\SearchWhere(source: SearchRequest\Attribute\PropertyValueSource::RequestAttribute)]
|
||||
public int $id;
|
||||
|
||||
#[SearchWhere(method: SearchMethodEnum::Like)]
|
||||
public string $message;
|
||||
|
||||
#[SearchOrderBy(parameter: "created_at",)]
|
||||
public string $createdAt = SearchOrderBy::DESCENDING;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user