mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-16 18:01:38 +00:00
Migrate getRepository with entities
This commit is contained in:
parent
50a941d8b4
commit
8b7b4975d6
38 changed files with 226 additions and 202 deletions
|
@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Validator\Constraints\Locale as LocaleConstraint;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule;
|
||||
use Wallabag\CoreBundle\Entity\RuleInterface;
|
||||
|
@ -132,7 +133,7 @@ class ConfigController extends Controller
|
|||
|
||||
if ($request->query->has('tagging-rule')) {
|
||||
$taggingRule = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:TaggingRule')
|
||||
->getRepository(TaggingRule::class)
|
||||
->find($request->query->get('tagging-rule'));
|
||||
|
||||
if ($this->getUser()->getId() !== $taggingRule->getConfig()->getUser()->getId()) {
|
||||
|
@ -195,7 +196,7 @@ class ConfigController extends Controller
|
|||
|
||||
if ($request->query->has('ignore-origin-user-rule')) {
|
||||
$ignoreOriginUserRule = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:IgnoreOriginUserRule')
|
||||
->getRepository(IgnoreOriginUserRule::class)
|
||||
->find($request->query->get('ignore-origin-user-rule'));
|
||||
|
||||
if ($this->getUser()->getId() !== $ignoreOriginUserRule->getConfig()->getUser()->getId()) {
|
||||
|
@ -548,7 +549,7 @@ class ConfigController extends Controller
|
|||
switch ($type) {
|
||||
case 'annotations':
|
||||
$this->getDoctrine()
|
||||
->getRepository('WallabagAnnotationBundle:Annotation')
|
||||
->getRepository(Annotation::class)
|
||||
->removeAllByUserId($this->getUser()->getId());
|
||||
break;
|
||||
case 'tags':
|
||||
|
@ -558,7 +559,7 @@ class ConfigController extends Controller
|
|||
// SQLite doesn't care about cascading remove, so we need to manually remove associated stuff
|
||||
// otherwise they won't be removed ...
|
||||
if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
$this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId());
|
||||
$this->getDoctrine()->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId());
|
||||
}
|
||||
|
||||
// manually remove tags to avoid orphan tag
|
||||
|
@ -735,7 +736,7 @@ class ConfigController extends Controller
|
|||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$archivedEntriesAnnotations = $this->getDoctrine()
|
||||
->getRepository('WallabagAnnotationBundle:Annotation')
|
||||
->getRepository(Annotation::class)
|
||||
->findAllArchivedEntriesByUser($userId);
|
||||
|
||||
foreach ($archivedEntriesAnnotations as $archivedEntriesAnnotation) {
|
||||
|
@ -764,7 +765,7 @@ class ConfigController extends Controller
|
|||
private function getConfig()
|
||||
{
|
||||
$config = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Config')
|
||||
->getRepository(Config::class)
|
||||
->findOneByUser($this->getUser());
|
||||
|
||||
// should NEVER HAPPEN ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue