Use statements & update translation

This commit is contained in:
Jeremy Benoist 2016-10-11 21:45:43 +02:00
parent 8c61fd12b1
commit b0de88f75d
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
7 changed files with 28 additions and 34 deletions

View file

@ -20,7 +20,7 @@ parameters:
database_table_prefix: wallabag_
database_socket: null
# with MySQL, use "utf8mb4" if got problem with content with emojis
database_charset: utf8
database_charset: utf8mb4
mailer_transport: smtp
mailer_host: 127.0.0.1

View file

@ -12,6 +12,7 @@ What is the meaning of the parameters?
"database_path", "``""%kernel.root_dir%/../data/db/wallabag.sqlite""``", "only for SQLite, define where to put the database file. Leave it for other database"
"database_table_prefix", "wallabag_", "all wallabag's tables will be prefixed with that string. You can include a ``_`` for clarity"
"database_socket", "null", "If your database is using a socket instead of tcp, put the path of the socket (other connection parameters will then be ignored"
"database_charset", "utf8mb4", "For PostgreSQL you should use utf8, for other use utf8mb4 which handle emoji"
.. csv-table:: Configuration to send emails from wallabag
:header: "name", "default", "description"

View file

@ -116,7 +116,8 @@ class AnnotationRepository extends EntityRepository
public function removeAllByUserId($userId)
{
$this->getEntityManager()
->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$userId)
->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = :userId')
->setParameter('userId', $userId)
->execute();
}
}

View file

@ -90,15 +90,15 @@ class TagController extends Controller
$flatTags = [];
foreach ($tags as $key => $tag) {
foreach ($tags as $tag) {
$nbEntries = $this->getDoctrine()
->getRepository('WallabagCoreBundle:Entry')
->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag['id']);
->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId());
$flatTags[] = [
'id' => $tag['id'],
'label' => $tag['label'],
'slug' => $tag['slug'],
'id' => $tag->getId(),
'label' => $tag->getLabel(),
'slug' => $tag->getSlug(),
'nbEntries' => $nbEntries,
];
}

View file

@ -339,7 +339,8 @@ class EntryRepository extends EntityRepository
public function removeAllByUserId($userId)
{
$this->getEntityManager()
->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = '.$userId)
->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId')
->setParameter('userId', $userId)
->execute();
}
}

View file

@ -34,6 +34,9 @@ class TagRepository extends EntityRepository
/**
* Find all tags per user.
* Instead of just left joined on the Entry table, we select only id and group by id to avoid tag multiplication in results.
* Once we have all tags id, we can safely request them one by one.
* This'll still be fastest than the previous query.
*
* @param int $userId
*
@ -41,32 +44,20 @@ class TagRepository extends EntityRepository
*/
public function findAllTags($userId)
{
return $this->createQueryBuilder('t')
->select('t.slug', 't.label', 't.id')
$ids = $this->createQueryBuilder('t')
->select('t.id')
->leftJoin('t.entries', 'e')
->where('e.user = :userId')->setParameter('userId', $userId)
->groupBy('t.slug')
->addGroupBy('t.label')
->addGroupBy('t.id')
->groupBy('t.id')
->getQuery()
->getArrayResult();
}
/**
* Find all tags.
*
* @param int $userId
*
* @return array
*/
public function findAllTags($userId)
{
return $this->createQueryBuilder('t')
->select('t')
->leftJoin('t.entries', 'e')
->where('e.user = :userId')->setParameter('userId', $userId)
->getQuery()
->getResult();
$tags = [];
foreach ($ids as $id) {
$tags[] = $this->find($id);
}
return $tags;
}
/**

View file

@ -91,15 +91,15 @@ config:
delete:
title: Supprimer mon compte (attention danger !)
description: Si vous confirmez la suppression de votre compte, TOUS les articles, TOUS les tags, TOUTES les annotations et votre compte seront DÉFINITIVEMENT supprimé (c'est IRRÉVERSIBLE). Vous serez ensuite déconnecté.
confirm: Vous êtes vraiment sûr ? (C'EST IRREVERSIBLE)
confirm: Vous êtes vraiment sûr ? (C'EST IRRÉVERSIBLE)
button: 'Supprimer mon compte'
reset:
title: Réinitialisation (attention danger !)
description: En cliquant sur les boutons ci-dessous vous avez la possibilité de supprimer certaines informations de votre compte. Attention, ces actions sont IRREVERSIBLES !
description: En cliquant sur les boutons ci-dessous vous avez la possibilité de supprimer certaines informations de votre compte. Attention, ces actions sont IRRÉVERSIBLES !
annotations: Supprimer TOUTES les annotations
tags: Supprimer TOUS les tags
entries: Supprimer TOUS les articles
confirm: Êtes-vous vraiment vraiment sûr ? (C'EST IRREVERSIBLE)
confirm: Êtes-vous vraiment vraiment sûr ? (C'EST IRRÉVERSIBLE)
form_password:
old_password_label: 'Mot de passe actuel'
new_password_label: 'Nouveau mot de passe'
@ -398,7 +398,7 @@ developer:
field_grant_types: 'Type de privilège accordé'
no_client: 'Aucun client pour le moment'
remove:
warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRREVERSIBLE !'
warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRRÉVERSIBLE !'
warn_message_2: "Si vous supprimez le client %name%, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag."
action: 'Supprimer le client %name%'
client:
@ -474,7 +474,7 @@ flashes:
entries_reset: Articles supprimés
entry:
notice:
entry_already_saved: 'Article déjà sauvergardé le %date%'
entry_already_saved: 'Article déjà sauvegardé le %date%'
entry_saved: 'Article enregistré'
entry_saved_failed: 'Article enregistré mais impossible de récupérer le contenu'
entry_updated: 'Article mis à jour'