class NotificationSerializer extends AbstractSerializer

Properties

protected ServerRequestInterface $request from AbstractSerializer
protected User $actor from AbstractSerializer
static protected Container $container from AbstractSerializer
static protected array<string,callable[]> $attributeMutators from AbstractSerializer
static protected array<string,array<string,callable>> $customRelations from AbstractSerializer
protected $type <p>{@inheritdoc}</p>
static protected array $subjectSerializers <p>A map of notification types (key) to the serializer that should be used to output the notification's subject (value).</p>

Methods

ServerRequestInterface
getRequest()

No description

setRequest(ServerRequestInterface $request)

No description

getActor()

No description

getAttributes($model, array $fields = null)

<p>{@inheritdoc}</p>

array
getDefaultAttributes(Notification $notification)

<p>Get the default set of serialized attributes for a model.</p>

string|null
formatDate(DateTime $date = null)

No description

getRelationship($model, $name)

<p>{@inheritdoc}</p>

Relationship|null
getCustomRelationship(mixed $model, string $name)

<p>Get a custom relationship.</p>

Relationship
hasOne(mixed $model, string|Closure|SerializerInterface $serializer, string|Closure|null $relation = null)

<p>Get a relationship builder for a has-one relationship.</p>

Relationship
hasMany(mixed $model, string|Closure|SerializerInterface $serializer, string|null $relation = null)

<p>Get a relationship builder for a has-many relationship.</p>

Relationship|null
buildRelationship(mixed $model, string|Closure|SerializerInterface $serializer, string|null $relation = null, bool $many = false)

No description

mixed
getRelationshipData(mixed $model, string $relation)

No description

SerializerInterface
resolveSerializer(mixed $serializer, mixed $model, mixed $data)

No description

object
resolveSerializerClass(string $class)

No description

static Container
getContainer()

No description

static 
setContainer(Container $container)

No description

static void
addAttributeMutator(string $serializerClass, callable $callback)

No description

static void
setRelationship(string $serializerClass, string $relation, callable $callback)

No description

Relationship
user(Notification $notification)

No description

Relationship
fromUser(Notification $notification)

No description

Relationship
subject(Notification $notification)

No description

static 
setSubjectSerializer($type, $serializer)

No description

Details

ServerRequestInterface getRequest()

Return Value

ServerRequestInterface

setRequest(ServerRequestInterface $request)

Parameters

ServerRequestInterface $request

User getActor()

Return Value

User

getAttributes($model, array $fields = null)

<p>{@inheritdoc}</p>

Parameters

$model
array $fields

protected array getDefaultAttributes(Notification $notification)

<p>Get the default set of serialized attributes for a model.</p>

Parameters

Notification $notification

Return Value

array

string|null formatDate(DateTime $date = null)

Parameters

DateTime $date

Return Value

string|null

getRelationship($model, $name)

<p>{@inheritdoc}</p>

Parameters

$model
$name

protected Relationship|null getCustomRelationship(mixed $model, string $name)

<p>Get a custom relationship.</p>

Parameters

mixed $model
string $name

Return Value

Relationship|null

Relationship hasOne(mixed $model, string|Closure|SerializerInterface $serializer, string|Closure|null $relation = null)

<p>Get a relationship builder for a has-one relationship.</p>

Parameters

mixed $model
string|Closure|SerializerInterface $serializer
string|Closure|null $relation

Return Value

Relationship

Relationship hasMany(mixed $model, string|Closure|SerializerInterface $serializer, string|null $relation = null)

<p>Get a relationship builder for a has-many relationship.</p>

Parameters

mixed $model
string|Closure|SerializerInterface $serializer
string|null $relation

Return Value

Relationship

protected Relationship|null buildRelationship(mixed $model, string|Closure|SerializerInterface $serializer, string|null $relation = null, bool $many = false)

Parameters

mixed $model
string|Closure|SerializerInterface $serializer
string|null $relation
bool $many

Return Value

Relationship|null

protected mixed getRelationshipData(mixed $model, string $relation)

Parameters

mixed $model
string $relation

Return Value

mixed

protected SerializerInterface resolveSerializer(mixed $serializer, mixed $model, mixed $data)

Parameters

mixed $serializer
mixed $model
mixed $data

Return Value

SerializerInterface

Exceptions

InvalidArgumentException

protected object resolveSerializerClass(string $class)

Parameters

string $class

Return Value

object

static Container getContainer()

Return Value

Container

static setContainer(Container $container)

Parameters

Container $container

static void addAttributeMutator(string $serializerClass, callable $callback)

Parameters

string $serializerClass
callable $callback

Return Value

void

static void setRelationship(string $serializerClass, string $relation, callable $callback)

Parameters

string $serializerClass
string $relation
callable $callback

Return Value

void

protected Relationship user(Notification $notification)

Parameters

Notification $notification

Return Value

Relationship

protected Relationship fromUser(Notification $notification)

Parameters

Notification $notification

Return Value

Relationship

protected Relationship subject(Notification $notification)

Parameters

Notification $notification

Return Value

Relationship

static setSubjectSerializer($type, $serializer)

Parameters

$type
$serializer