@@ -13,17 +13,16 @@ |
||
| 13 | 13 | namespace Zikula\RoutesModule\Entity\Repository\Base; |
| 14 | 14 | |
| 15 | 15 | use Doctrine\Common\Collections\ArrayCollection; |
| 16 | -use Gedmo\Sortable\Entity\Repository\SortableRepository; |
|
| 17 | - |
|
| 18 | 16 | use Doctrine\ORM\Query; |
| 19 | 17 | use Doctrine\ORM\QueryBuilder; |
| 20 | 18 | use Doctrine\ORM\Tools\Pagination\Paginator; |
| 19 | +use Gedmo\Sortable\Entity\Repository\SortableRepository; |
|
| 21 | 20 | use InvalidArgumentException; |
| 22 | 21 | use Psr\Log\LoggerInterface; |
| 23 | 22 | use Zikula\Common\Translator\TranslatorInterface; |
| 24 | -use Zikula\UsersModule\Api\ApiInterface\CurrentUserApiInterface; |
|
| 25 | 23 | use Zikula\RoutesModule\Entity\RouteEntity; |
| 26 | 24 | use Zikula\RoutesModule\Helper\CollectionFilterHelper; |
| 25 | +use Zikula\UsersModule\Api\ApiInterface\CurrentUserApiInterface; |
|
| 27 | 26 | |
| 28 | 27 | /** |
| 29 | 28 | * Repository class used to implement own convenience methods for performing certain DQL queries. |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | $qb = $this->getEntityManager()->createQueryBuilder(); |
| 152 | 152 | $qb->update($this->mainEntityClass, 'tbl') |
| 153 | - ->set('tbl.createdBy', $newUserId) |
|
| 154 | - ->where('tbl.createdBy = :creator') |
|
| 155 | - ->setParameter('creator', $userId); |
|
| 153 | + ->set('tbl.createdBy', $newUserId) |
|
| 154 | + ->where('tbl.createdBy = :creator') |
|
| 155 | + ->setParameter('creator', $userId); |
|
| 156 | 156 | $query = $qb->getQuery(); |
| 157 | 157 | $query->execute(); |
| 158 | 158 | |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $qb = $this->getEntityManager()->createQueryBuilder(); |
| 185 | 185 | $qb->update($this->mainEntityClass, 'tbl') |
| 186 | - ->set('tbl.updatedBy', $newUserId) |
|
| 187 | - ->where('tbl.updatedBy = :editor') |
|
| 188 | - ->setParameter('editor', $userId); |
|
| 186 | + ->set('tbl.updatedBy', $newUserId) |
|
| 187 | + ->where('tbl.updatedBy = :editor') |
|
| 188 | + ->setParameter('editor', $userId); |
|
| 189 | 189 | $query = $qb->getQuery(); |
| 190 | 190 | $query->execute(); |
| 191 | 191 | |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $qb = $this->getEntityManager()->createQueryBuilder(); |
| 216 | 216 | $qb->delete($this->mainEntityClass, 'tbl') |
| 217 | - ->where('tbl.createdBy = :creator') |
|
| 218 | - ->setParameter('creator', $userId); |
|
| 217 | + ->where('tbl.createdBy = :creator') |
|
| 218 | + ->setParameter('creator', $userId); |
|
| 219 | 219 | $query = $qb->getQuery(); |
| 220 | 220 | $query->execute(); |
| 221 | 221 | |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $qb = $this->getEntityManager()->createQueryBuilder(); |
| 246 | 246 | $qb->delete($this->mainEntityClass, 'tbl') |
| 247 | - ->where('tbl.updatedBy = :editor') |
|
| 248 | - ->setParameter('editor', $userId); |
|
| 247 | + ->where('tbl.updatedBy = :editor') |
|
| 248 | + ->setParameter('editor', $userId); |
|
| 249 | 249 | $query = $qb->getQuery(); |
| 250 | 250 | $query->execute(); |
| 251 | 251 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | if (count($exclusions) > 0) { |
| 332 | 332 | $qb->andWhere('tbl.id NOT IN (:excludedIdentifiers)') |
| 333 | - ->setParameter('excludedIdentifiers', $exclusions); |
|
| 333 | + ->setParameter('excludedIdentifiers', $exclusions); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | return $qb; |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | $offset = ($currentPage - 1) * $resultsPerPage; |
| 391 | 391 | |
| 392 | 392 | $query->setFirstResult($offset) |
| 393 | - ->setMaxResults($resultsPerPage); |
|
| 393 | + ->setMaxResults($resultsPerPage); |
|
| 394 | 394 | |
| 395 | 395 | return $query; |
| 396 | 396 | } |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | $qb = $this->getEntityManager()->createQueryBuilder(); |
| 489 | 489 | $qb->select($selection) |
| 490 | - ->from($this->mainEntityClass, 'tbl'); |
|
| 490 | + ->from($this->mainEntityClass, 'tbl'); |
|
| 491 | 491 | |
| 492 | 492 | if (!empty($where)) { |
| 493 | 493 | $qb->andWhere($where); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | { |
| 537 | 537 | $qb = $this->getCountQuery('', false); |
| 538 | 538 | $qb->andWhere('tbl.' . $fieldName . ' = :' . $fieldName) |
| 539 | - ->setParameter($fieldName, $fieldValue); |
|
| 539 | + ->setParameter($fieldName, $fieldValue); |
|
| 540 | 540 | |
| 541 | 541 | if ($excludeId > 0) { |
| 542 | 542 | $qb = $this->addExclusion($qb, [$excludeId]); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | |
| 580 | 580 | $qb = $this->getEntityManager()->createQueryBuilder(); |
| 581 | 581 | $qb->select($selection) |
| 582 | - ->from($this->mainEntityClass, 'tbl'); |
|
| 582 | + ->from($this->mainEntityClass, 'tbl'); |
|
| 583 | 583 | |
| 584 | 584 | if (true === $useJoins) { |
| 585 | 585 | $this->addJoinsToFrom($qb); |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | if ($orderBy == 'RAND()') { |
| 608 | 608 | // random selection |
| 609 | 609 | $qb->addSelect('MOD(tbl.id, ' . mt_rand(2, 15) . ') AS HIDDEN randomIdentifiers') |
| 610 | - ->add('orderBy', 'randomIdentifiers'); |
|
| 610 | + ->add('orderBy', 'randomIdentifiers'); |
|
| 611 | 611 | |
| 612 | 612 | return $qb; |
| 613 | 613 | } |
@@ -626,12 +626,12 @@ discard block |
||
| 626 | 626 | } |
| 627 | 627 | if (false !== strpos($orderBy, 'tbl.createdBy')) { |
| 628 | 628 | $qb->addSelect('tblCreator') |
| 629 | - ->leftJoin('tbl.createdBy', 'tblCreator'); |
|
| 629 | + ->leftJoin('tbl.createdBy', 'tblCreator'); |
|
| 630 | 630 | $orderBy = str_replace('tbl.createdBy', 'tblCreator.uname', $orderBy); |
| 631 | 631 | } |
| 632 | 632 | if (false !== strpos($orderBy, 'tbl.updatedBy')) { |
| 633 | 633 | $qb->addSelect('tblUpdater') |
| 634 | - ->leftJoin('tbl.updatedBy', 'tblUpdater'); |
|
| 634 | + ->leftJoin('tbl.updatedBy', 'tblUpdater'); |
|
| 635 | 635 | $orderBy = str_replace('tbl.updatedBy', 'tblUpdater.uname', $orderBy); |
| 636 | 636 | } |
| 637 | 637 | $qb->add('orderBy', $orderBy); |
@@ -281,7 +281,7 @@ |
||
| 281 | 281 | /** |
| 282 | 282 | * Selects an object from the database. |
| 283 | 283 | * |
| 284 | - * @param mixed $id The id (or array of ids) to use to retrieve the object (optional) (default=0) |
|
| 284 | + * @param integer $id The id (or array of ids) to use to retrieve the object (optional) (default=0) |
|
| 285 | 285 | * @param boolean $useJoins Whether to include joining related objects (optional) (default=true) |
| 286 | 286 | * @param boolean $slimMode If activated only some basic fields are selected without using any joins (optional) (default=false) |
| 287 | 287 | * |
@@ -12,13 +12,11 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace Zikula\RoutesModule\Form\Handler\Route\Base; |
| 14 | 14 | |
| 15 | +use RuntimeException; |
|
| 16 | +use Symfony\Component\HttpFoundation\RedirectResponse; |
|
| 15 | 17 | use Zikula\RoutesModule\Form\Handler\Common\EditHandler; |
| 16 | 18 | use Zikula\RoutesModule\Form\Type\RouteType; |
| 17 | 19 | |
| 18 | -use Symfony\Component\HttpFoundation\RedirectResponse; |
|
| 19 | -use Symfony\Component\Security\Core\Exception\AccessDeniedException; |
|
| 20 | -use RuntimeException; |
|
| 21 | - |
|
| 22 | 20 | /** |
| 23 | 21 | * This handler class handles the page events of editing forms. |
| 24 | 22 | * It aims on the route object type. |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
| 17 | 17 | use Zikula\Common\Translator\TranslatorInterface; |
| 18 | 18 | use Zikula\Core\Event\GenericEvent; |
| 19 | +use Zikula\RoutesModule\Entity\Factory\EntityFactory; |
|
| 19 | 20 | use Zikula\UsersModule\Api\ApiInterface\CurrentUserApiInterface; |
| 20 | 21 | use Zikula\UsersModule\Constant as UsersConstant; |
| 21 | 22 | use Zikula\UsersModule\UserEvents; |
| 22 | -use Zikula\RoutesModule\Entity\Factory\EntityFactory; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Event handler base class for user-related events. |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; |
| 18 | 18 | use Symfony\Component\DependencyInjection\ContainerAwareTrait; |
| 19 | 19 | use Zikula\Common\Translator\TranslatorTrait; |
| 20 | -use Zikula\UsersModule\Constant as UsersConstant; |
|
| 21 | 20 | use Zikula\RoutesModule\Entity\RouteEntity; |
| 21 | +use Zikula\UsersModule\Constant as UsersConstant; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * This is the item actions menu implementation class. |
@@ -211,7 +211,7 @@ |
||
| 211 | 211 | return false; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - $out = "GET $path_query? HTTP/1.1\r\n"; |
|
| 214 | + $out = "get $path_query? HTTP/1.1\r\n"; |
|
| 215 | 215 | $out .= "User-Agent: $userAgent\r\n"; |
| 216 | 216 | $out .= "Referer: $ref\r\n"; |
| 217 | 217 | $out .= "Host: $urlArray[host]\r\n"; |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - list($id, , $timestamp) = $this->tokenGenerator->decode($token); |
|
| 73 | + list($id,, $timestamp) = $this->tokenGenerator->decode($token); |
|
| 74 | 74 | $decoded = [ |
| 75 | 75 | 'id' => $id, |
| 76 | 76 | 'time' => $timestamp |
@@ -56,7 +56,8 @@ |
||
| 56 | 56 | $parent = $repo->find($request->request->get('parent')); |
| 57 | 57 | $menuItemEntity->setParent($parent); |
| 58 | 58 | $menuItemEntity->setRoot($parent->getRoot()); |
| 59 | - } elseif (empty($parentId) && $request->request->has('after')) { // sibling of top-level child |
|
| 59 | + } elseif (empty($parentId) && $request->request->has('after')) { |
|
| 60 | +// sibling of top-level child |
|
| 60 | 61 | $sibling = $repo->find($request->request->get('after')); |
| 61 | 62 | $menuItemEntity->setParent($sibling->getParent()); |
| 62 | 63 | $menuItemEntity->setRoot($sibling->getRoot()); |
@@ -173,14 +173,14 @@ discard block |
||
| 173 | 173 | if ((!is_numeric($v) && $v != '') || (is_numeric($v) && $v > 0)) { |
| 174 | 174 | if ($k == 'workflowState' && substr($v, 0, 1) == '!') { |
| 175 | 175 | $qb->andWhere('tbl.' . $k . ' != :' . $k) |
| 176 | - ->setParameter($k, substr($v, 1, strlen($v) - 1)); |
|
| 176 | + ->setParameter($k, substr($v, 1, strlen($v) - 1)); |
|
| 177 | 177 | } elseif (substr($v, 0, 1) == '%') { |
| 178 | 178 | $qb->andWhere('tbl.' . $k . ' LIKE :' . $k) |
| 179 | - ->setParameter($k, '%' . $v . '%'); |
|
| 179 | + ->setParameter($k, '%' . $v . '%'); |
|
| 180 | 180 | } else { |
| 181 | 181 | $qb->andWhere('tbl.' . $k . ' = :' . $k) |
| 182 | - ->setParameter($k, $v); |
|
| 183 | - } |
|
| 182 | + ->setParameter($k, $v); |
|
| 183 | + } |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | if (is_array($userId)) { |
| 291 | 291 | $qb->andWhere('tbl.createdBy IN (:userIds)') |
| 292 | - ->setParameter('userIds', $userId); |
|
| 292 | + ->setParameter('userIds', $userId); |
|
| 293 | 293 | } else { |
| 294 | 294 | $qb->andWhere('tbl.createdBy = :userId') |
| 295 | - ->setParameter('userId', $userId); |
|
| 295 | + ->setParameter('userId', $userId); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | return $qb; |
@@ -17,7 +17,6 @@ |
||
| 17 | 17 | use Symfony\Component\HttpFoundation\RequestStack; |
| 18 | 18 | use Zikula\UsersModule\Api\ApiInterface\CurrentUserApiInterface; |
| 19 | 19 | use Zikula\UsersModule\Constant as UsersConstant; |
| 20 | -use Zikula\RoutesModule\Entity\RouteEntity; |
|
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | 22 | * Entity collection filter helper base class. |
@@ -67,6 +67,9 @@ |
||
| 67 | 67 | return $links; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | + /** |
|
| 71 | + * @param string $containerName |
|
| 72 | + */ |
|
| 70 | 73 | public function hasContainer($containerName) |
| 71 | 74 | { |
| 72 | 75 | return isset($this->linkContainers[$containerName]); |