Applied symplify rules to codebase.

This commit is contained in:
Jan Böhmer 2020-01-05 22:49:00 +01:00
parent 2f20d90041
commit 388e847b17
136 changed files with 1370 additions and 789 deletions

View file

@ -27,6 +27,7 @@ namespace App\Repository;
use App\Entity\Base\StructuralDBElement;
use App\Helpers\Trees\StructuralDBElementIterator;
use App\Helpers\Trees\TreeViewNode;
use RecursiveIteratorIterator;
class StructuralDBElementRepository extends NamedDBElementRepository
{
@ -80,7 +81,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
$entities = $this->findBy(['parent' => $parent], ['name' => 'ASC']);
$elementIterator = new StructuralDBElementIterator($entities);
$recursiveIterator = new \RecursiveIteratorIterator($elementIterator, \RecursiveIteratorIterator::SELF_FIRST);
$recursiveIterator = new RecursiveIteratorIterator($elementIterator, RecursiveIteratorIterator::SELF_FIRST);
//$result = iterator_to_array($recursiveIterator);
//We can not use iterator_to_array here or we get only the parent elements

View file

@ -35,7 +35,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
* @method User[] findAll()
* @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserRepository extends NamedDBElementRepository implements PasswordUpgraderInterface
final class UserRepository extends NamedDBElementRepository implements PasswordUpgraderInterface
{
protected $anonymous_user;
@ -74,11 +74,14 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
->where('u.name = (:name)')
->orWhere('u.email = (:email)');
$qb->setParameters(['email' => $name_or_password, 'name' => $name_or_password]);
$qb->setParameters([
'email' => $name_or_password,
'name' => $name_or_password,
]);
try {
return $qb->getQuery()->getOneOrNullResult();
} catch (NonUniqueResultException $exception) {
} catch (NonUniqueResultException $nonUniqueResultException) {
return null;
}
}