Skip to content

Commit

Permalink
Route attribute (#609)
Browse files Browse the repository at this point in the history
* fix-gridview
* fix PageToken
* fix routeArgument
  • Loading branch information
pamparam83 authored Feb 20, 2024
1 parent f80b773 commit 9122601
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion blog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ More routes could be added by editing `src/Factory/AppRouterFactory`.
The template comes with a ready to use [Codeception](https://codeception.com/) configuration.
In order to execute tests run the following command:

```
```bash
composer run serve 127.0.0.1:8080 > ./runtime/yii.log 2>&1 &
vendor/bin/codecept run
```
Expand Down
2 changes: 1 addition & 1 deletion blog/config/common/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Yiisoft\Translator\TranslatorInterface;
use Yiisoft\Yii\Cycle\Schema\Conveyor\AttributedSchemaConveyor;
use Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider;
use Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider;
use \Cycle\Schema\Provider\PhpFileSchemaProvider;
use Yiisoft\Yii\View\CsrfViewInjection;

return [
Expand Down
2 changes: 0 additions & 2 deletions blog/resources/views/user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@
->dataReader($paginator)
->pagination(
OffsetPagination::widget()
->menuClass('pagination justify-content-center')
->paginator($paginator)
->urlArguments([])
->render(),
)
->rowAttributes(['class' => 'align-middle'])
Expand Down
2 changes: 1 addition & 1 deletion blog/src/Auth/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function login(
) {
$identity = $this->authService->getIdentity();

if ($identity instanceof CookieLoginIdentityInterface && $loginForm->getAttributeValue('rememberMe')) {
if ($identity instanceof CookieLoginIdentityInterface && $loginForm->getPropertyValue('rememberMe')) {
return $cookieLogin->addCookie($identity, $this->redirectToMain());
}

Expand Down
2 changes: 1 addition & 1 deletion blog/src/Blog/Archive/ArchiveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\Blog\Tag\TagRepository;
use Psr\Http\Message\ResponseInterface as Response;
use Yiisoft\Data\Paginator\OffsetPaginator;
use Yiisoft\Hydrator\Temp\RouteArgument;
use Yiisoft\Router\HydratorAttribute\RouteArgument;
use Yiisoft\Yii\View\ViewRenderer;

final class ArchiveController
Expand Down
2 changes: 1 addition & 1 deletion blog/src/Blog/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use App\Blog\Tag\TagRepository;
use Psr\Http\Message\ResponseInterface as Response;
use Yiisoft\Data\Paginator\OffsetPaginator;
use Yiisoft\Hydrator\Temp\RouteArgument;
use Yiisoft\Router\HydratorAttribute\RouteArgument;
use Yiisoft\User\CurrentUser;
use Yiisoft\Yii\View\ViewRenderer;

Expand Down
2 changes: 1 addition & 1 deletion blog/src/Blog/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\Blog\Comment\CommentService;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Yiisoft\Hydrator\Temp\RouteArgument;
use Yiisoft\Router\HydratorAttribute\RouteArgument;
use Yiisoft\Yii\View\ViewRenderer;

final class CommentController
Expand Down
6 changes: 3 additions & 3 deletions blog/src/User/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
namespace App\User\Controller;

use App\User\UserRepository;
use Yiisoft\Data\Paginator\PageToken;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Yiisoft\Data\Paginator\OffsetPaginator;
use Yiisoft\Data\Reader\Sort;
use Yiisoft\Input\Http\Attribute\Parameter\Body;
use Yiisoft\Input\Http\Attribute\Parameter\Query;
use Yiisoft\Hydrator\Temp\RouteArgument;
use Yiisoft\Router\HydratorAttribute\RouteArgument;
use Yiisoft\Yii\View\ViewRenderer;

final class UserController
{
private const PAGINATION_INDEX = 5;

public function __construct(private ViewRenderer $viewRenderer)
{
Expand All @@ -40,7 +40,7 @@ public function index(
}

$paginator = (new OffsetPaginator($dataReader));
$paginator = $paginator->withNextPageToken((string) $page)->withPageSize($pageSize);
$paginator = $paginator->withToken(PageToken::next((string) $page))->withPageSize($pageSize);

return $this->viewRenderer->render('index', ['paginator' => $paginator]);
}
Expand Down
2 changes: 1 addition & 1 deletion blog/src/Widget/OffsetPagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function urlGenerator(Closure $generator): self

public function isRequired(): bool
{
return $this->paginator !== null && $this->paginator->isRequired();
return $this->paginator !== null && $this->paginator->isPaginationRequired();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion blog/tests/Acceptance/LoginAcceptanceCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testLoginSubmitFormWrongDataPassword(AcceptanceTester $I): void
}

/**
* @depends \App\Tests\Acceptance\SignupAcceptanceCest:testRegisterSuccess
* @depends App\Tests\Acceptance\SignupAcceptanceCest:testRegisterSuccess
*/
public function testLoginUsernameSubmitFormSuccessData(AcceptanceTester $I): void
{
Expand Down

0 comments on commit 9122601

Please sign in to comment.