id; } /** * {@inheritdoc} */ public function getAttributes($resource, ContextInterface $context): iterable { return [ 'content' => (string) $resource['content'], 'mkdate' => date('c', $resource['mkdate']), 'chdate' => date('c', $resource['chdate']), ]; } /** * {@inheritdoc} */ public function getRelationships($resource, ContextInterface $context): iterable { $relationships = []; $relationships[self::REL_LECTURER] = $resource['lecturer_id'] ? [ self::RELATIONSHIP_LINKS => [ Link::RELATED => $this->createLinkToResource($resource->lecturer), ], self::RELATIONSHIP_DATA => $resource->lecturer, ] : [self::RELATIONSHIP_DATA => $resource->lecturer]; $relationships[self::REL_TASK] = [ self::RELATIONSHIP_LINKS => [ Link::RELATED => $this->getRelationshipRelatedLink($resource, self::REL_TASK), ], ]; return $relationships; } }