Avoid using model methods and use repository instead

This commit is contained in:
James Cole
2018-03-19 19:39:02 +01:00
parent aecffe10d9
commit 1645490f5c
8 changed files with 140 additions and 43 deletions

View File

@@ -66,6 +66,30 @@ class TransactionJournal extends Twig_Extension
return $result;
}
/**
* Return if journal HAS field.
*
* @param JournalModel $journal
* @param string $field
*
* @return bool
*/
public function hasMetaField(JournalModel $journal, string $field): bool
{
// HIER BEN JE
/** @var JournalRepositoryInterface $repository */
$repository = app(JournalRepositoryInterface::class);
$result = $repository->getMetaField($journal, $field);
if (is_null($result)) {
return false;
}
if (strlen(strval($result)) === 0) {
return false;
}
return true;
}
/**
* @param JournalModel $journal
*