return 1;
}
} else {
- $users = $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findAll();
+ $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
$output->writeln(sprintf('Cleaning through %d user accounts', count($users)));
private function cleanDuplicates(User $user)
{
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
- $repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
+ $repo = $this->getContainer()->get('wallabag_core.entry_repository');
$entries = $repo->getAllEntriesIdAndUrl($user->getId());
$url = $this->similarUrl($entry['url']);
/* @var $entry Entry */
- if (in_array($url, $urls)) {
+ if (in_array($url, $urls, true)) {
++$duplicatesCount;
$em->remove($repo->find($entry['id']));
private function similarUrl($url)
{
- if (in_array(substr($url, -1), ['/', '#'])) { // get rid of "/" and "#" and the end of urls
+ if (in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
return substr($url, 0, strlen($url));
}
*/
private function getUser($username)
{
- return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username);
+ return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
}
private function getDoctrine()