1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-16 18:01:38 +00:00

Use FQCN as service name for repositories

This commit is contained in:
Yassine Guedidi 2022-04-24 17:58:57 +02:00
parent 844e8e9d22
commit 0f9c359476
17 changed files with 68 additions and 50 deletions

View file

@ -21,6 +21,8 @@ use Wallabag\CoreBundle\Form\Type\SearchEntryType;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\CoreBundle\Helper\Redirect;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
class EntryController extends Controller
{
@ -58,7 +60,7 @@ class EntryController extends Controller
$label = substr($label, 1);
$remove = true;
}
$tag = $this->get('wallabag_core.tag_repository')->findOneByLabel($label);
$tag = $this->get(TagRepository::class)->findOneByLabel($label);
if ($remove) {
if (null !== $tag) {
$tagsToRemove[] = $tag;
@ -77,7 +79,7 @@ class EntryController extends Controller
if (isset($values['entry-checkbox'])) {
foreach ($values['entry-checkbox'] as $id) {
/** @var Entry * */
$entry = $this->get('wallabag_core.entry_repository')->findById((int) $id)[0];
$entry = $this->get(EntryRepository::class)->findById((int) $id)[0];
$this->checkUserAction($entry);
@ -272,7 +274,7 @@ class EntryController extends Controller
public function showUnreadAction(Request $request, $page)
{
// load the quickstart if no entry in database
if (1 === (int) $page && 0 === $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId())) {
if (1 === (int) $page && 0 === $this->get(EntryRepository::class)->countAllEntriesByUser($this->getUser()->getId())) {
return $this->redirect($this->generateUrl('quickstart'));
}
@ -347,7 +349,7 @@ class EntryController extends Controller
public function redirectRandomEntryAction($type = 'all')
{
try {
$entry = $this->get('wallabag_core.entry_repository')
$entry = $this->get(EntryRepository::class)
->getRandomEntry($this->getUser()->getId(), $type);
} catch (NoResultException $e) {
$bag = $this->get('session')->getFlashBag();
@ -600,7 +602,7 @@ class EntryController extends Controller
*/
private function showEntries($type, Request $request, $page)
{
$repository = $this->get('wallabag_core.entry_repository');
$repository = $this->get(EntryRepository::class);
$searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : '');
$currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
@ -660,7 +662,7 @@ class EntryController extends Controller
}
}
$nbEntriesUntagged = $this->get('wallabag_core.entry_repository')
$nbEntriesUntagged = $this->get(EntryRepository::class)
->countUntaggedEntriesByUser($this->getUser()->getId());
return $this->render(
@ -724,6 +726,6 @@ class EntryController extends Controller
*/
private function checkIfEntryAlreadyExists(Entry $entry)
{
return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
return $this->get(EntryRepository::class)->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
}
}