Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] Add missing attributes to json_records #420

Merged
merged 2 commits into from May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/js/app/listing/Components/Table/Row/_Meta.vue
Expand Up @@ -2,10 +2,10 @@
<div class="listing__row--item is-meta">
<ul class="listing__row--list">
<li v-if="size === 'normal'">
<i class="fas fa-user mr-2"></i> {{ record.author.displayName }}
<i class="fas fa-user mr-2"></i> {{ record.authorName }}
</li>
<li v-if="size === 'normal'">
<i class="fas mr-2" :class="record.icon"></i>
<i class="fas mr-2" :class="record.extras.icon"></i>
<template v-if="type === 'dashboard'"
><a :href="`/bolt/content/${record.contentType}`">
{{ record.contentType }}</a
Expand All @@ -16,7 +16,7 @@
</li>
<li>
<span class="status mr-2" :class="`is-${record.status}`"></span
>{{ record.publishedAt.date|date }}
>{{ record.publishedAt|date }}
</li>
</ul>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/Entity/Content.php
Expand Up @@ -66,13 +66,15 @@ class Content
* @var string
*
* @ORM\Column(type="string", length=191)
* @Groups("get_content")
*/
private $status;

/**
* @var \DateTime
*
* @ORM\Column(type="datetime")
* @Groups("get_content")
*/
private $createdAt;

Expand All @@ -96,6 +98,7 @@ class Content
* @var \DateTime|null
*
* @ORM\Column(type="datetime", nullable=true)
* @Groups("get_content")
*/
private $depublishedAt = null;

Expand Down
1 change: 1 addition & 0 deletions src/Entity/ContentExtrasTrait.php
Expand Up @@ -38,6 +38,7 @@ public function getExtras(): array
'excerpt' => $this->contentExtension->getExcerpt($content),
'link' => $this->contentExtension->getLink($content),
'editLink' => $this->contentExtension->getEditLink($content),
'icon' => $this->getIcon(),
];
}
}
3 changes: 2 additions & 1 deletion src/Twig/JsonExtension.php
Expand Up @@ -58,7 +58,8 @@ public function normalizeRecords($records): array

private function contentToArray(Content $content): array
{
// we do it that way because in current API Platform version a Resource can't implement \JsonSerializable
// we do it that way because in current API Platform version a Resource
// can't implement \JsonSerializable
return $this->normalizer->normalize($content, null, ['group' => [self::SERIALIZE_GROUP]]);
}
}