PHP Class Flarum\Api\Serializer\AbstractSerializer

Inheritance: extends Tobscure\JsonApi\AbstractSerializer
Afficher le fichier Open project: flarum/core Class Usage Examples

Protected Properties

Свойство Type Description
$actor Flarum\Core\User
$container Illuminate\Contracts\Container\Container
$dispatcher Illuminate\Contracts\Events\Dispatcher

Méthodes publiques

Méthode Description
getActor ( ) : User
getAttributes ( $model, array $fields = null )
getContainer ( ) : Illuminate\Contracts\Container\Container
getEventDispatcher ( ) : Illuminate\Contracts\Events\Dispatcher
getRelationship ( $model, $name )
hasMany ( mixed $model, string | Closur\Closure | Tobscure\JsonApi\SerializerInterface $serializer, string | null $relation = null ) : Relationship Get a relationship builder for a has-many relationship.
hasOne ( mixed $model, string | Closur\Closure | Tobscure\JsonApi\SerializerInterface $serializer, string | Closur\Closure | null $relation = null ) : Relationship Get a relationship builder for a has-one relationship.
setActor ( User $actor )
setContainer ( Illuminate\Contracts\Container\Container $container )
setEventDispatcher ( Illuminate\Contracts\Events\Dispatcher $dispatcher )

Méthodes protégées

Méthode Description
buildRelationship ( mixed $model, string | Closur\Closure | Tobscure\JsonApi\SerializerInterface $serializer, string | null $relation = null, boolean $many = false ) : Relationship
formatDate ( DateTime $date = null ) : string | null
getCustomRelationship ( mixed $model, string $name ) : Relationship | null Get a custom relationship.
getDefaultAttributes ( object | array $model ) : array Get the default set of serialized attributes for a model.
getRelationshipData ( mixed $model, $relation ) : mixed
resolveSerializer ( mixed $serializer, mixed $model, mixed $data ) : Tobscure\JsonApi\SerializerInterface
resolveSerializerClass ( string $class ) : object

Method Details

buildRelationship() protected méthode

protected buildRelationship ( mixed $model, string | Closur\Closure | Tobscure\JsonApi\SerializerInterface $serializer, string | null $relation = null, boolean $many = false ) : Relationship
$model mixed
$serializer string | Closur\Closure | Tobscure\JsonApi\SerializerInterface
$relation string | null
$many boolean
Résultat Tobscure\JsonApi\Relationship

formatDate() protected méthode

protected formatDate ( DateTime $date = null ) : string | null
$date DateTime
Résultat string | null

getActor() public méthode

public getActor ( ) : User
Résultat Flarum\Core\User

getAttributes() public méthode

public getAttributes ( $model, array $fields = null )
$fields array

getContainer() public static méthode

public static getContainer ( ) : Illuminate\Contracts\Container\Container
Résultat Illuminate\Contracts\Container\Container

getCustomRelationship() protected méthode

Get a custom relationship.
protected getCustomRelationship ( mixed $model, string $name ) : Relationship | null
$model mixed
$name string
Résultat Tobscure\JsonApi\Relationship | null

getDefaultAttributes() abstract protected méthode

Get the default set of serialized attributes for a model.
abstract protected getDefaultAttributes ( object | array $model ) : array
$model object | array
Résultat array

getEventDispatcher() public static méthode

public static getEventDispatcher ( ) : Illuminate\Contracts\Events\Dispatcher
Résultat Illuminate\Contracts\Events\Dispatcher

getRelationship() public méthode

public getRelationship ( $model, $name )

getRelationshipData() protected méthode

protected getRelationshipData ( mixed $model, $relation ) : mixed
$model mixed
Résultat mixed

hasMany() public méthode

Get a relationship builder for a has-many relationship.
public hasMany ( mixed $model, string | Closur\Closure | Tobscure\JsonApi\SerializerInterface $serializer, string | null $relation = null ) : Relationship
$model mixed
$serializer string | Closur\Closure | Tobscure\JsonApi\SerializerInterface
$relation string | null
Résultat Tobscure\JsonApi\Relationship

hasOne() public méthode

Get a relationship builder for a has-one relationship.
public hasOne ( mixed $model, string | Closur\Closure | Tobscure\JsonApi\SerializerInterface $serializer, string | Closur\Closure | null $relation = null ) : Relationship
$model mixed
$serializer string | Closur\Closure | Tobscure\JsonApi\SerializerInterface
$relation string | Closur\Closure | null
Résultat Tobscure\JsonApi\Relationship

resolveSerializer() protected méthode

protected resolveSerializer ( mixed $serializer, mixed $model, mixed $data ) : Tobscure\JsonApi\SerializerInterface
$serializer mixed
$model mixed
$data mixed
Résultat Tobscure\JsonApi\SerializerInterface

resolveSerializerClass() protected méthode

protected resolveSerializerClass ( string $class ) : object
$class string
Résultat object

setActor() public méthode

public setActor ( User $actor )
$actor Flarum\Core\User

setContainer() public static méthode

public static setContainer ( Illuminate\Contracts\Container\Container $container )
$container Illuminate\Contracts\Container\Container

setEventDispatcher() public static méthode

public static setEventDispatcher ( Illuminate\Contracts\Events\Dispatcher $dispatcher )
$dispatcher Illuminate\Contracts\Events\Dispatcher

Property Details

$actor protected_oe property

protected User,Flarum\Core $actor
Résultat Flarum\Core\User

$container protected_oe static_oe property

protected static Container,Illuminate\Contracts\Container $container
Résultat Illuminate\Contracts\Container\Container

$dispatcher protected_oe static_oe property

protected static Dispatcher,Illuminate\Contracts\Events $dispatcher
Résultat Illuminate\Contracts\Events\Dispatcher