Fix media createdBy output

This commit is contained in:
Dennis Eichhorn 2017-07-27 20:37:47 +02:00
parent 2990f5694b
commit 1867c1b77e
3 changed files with 11 additions and 3 deletions

View File

@ -136,11 +136,11 @@ class Media
}
/**
* @return int
* @return mixed
*
* @since 1.0.0
*/
public function getCreatedBy() : int
public function getCreatedBy()
{
return $this->createdBy;
}

View File

@ -18,6 +18,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
use Modules\Admin\Models\AccountMapper;
class MediaMapper extends DataMapperAbstract
{
@ -42,6 +43,13 @@ class MediaMapper extends DataMapperAbstract
'media_created_at' => ['name' => 'media_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
];
protected static $belongsTo = [
'createdBy' => [
'mapper' => AccountMapper::class,
'dest' => 'media_created_by',
],
];
/**
* Primary table.
*

View File

@ -75,7 +75,7 @@ echo $this->getData('nav')->render(); ?>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getName(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getExtension(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getSize(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getCreatedBy(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getCreatedBy()->getName1(), ENT_COMPAT, 'utf-8'); ?></a>
<td><a href="<?= $url; ?>"><?= htmlspecialchars($value->getCreatedAt()->format('Y-m-d H:i:s'), ENT_COMPAT, 'utf-8'); ?></a>
<?php endforeach; ?>
<?php if($count === 0) : ?>