Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Úkol 2 - Vojtěch Havlíček #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

spitd1
Copy link

@spitd1 spitd1 commented Oct 15, 2016

6 products per page by default

for simple import to fresh database (through phpmyadmin, etc)
6 products per page by default
Copy link
Member

@klatys klatys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

škoda, že to není i v kategorii, ale princip bude stejný, takže to neva

@@ -44,7 +44,7 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="{{ path("homepage") }}">Domů</a>
<a href="{{ path("homepage", {"page":1}) }}">Domů</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asi bych takový argument nepředával - spíš pak někde uděláš chybu, navíc url /1 není nijak hezká

{
$perPage = 6;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tohle je hodnota, která by měla být spíše v konfiguraci

{
$perPage = 6;
$currentPage = $request->attributes->get("page");
$totalProducts = $this->getDoctrine()->getRepository(Product::class)->findBy([]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tady pozor, taháš celé produkty jen na to abys je spočítal... teď jich je 44, když jich bude x tisíc, bude to drahé...


/**
* @author Jan Klat <jenik@klatys.cz>
*/
class HomepageController extends Controller
{
/**
* @Route("/", name="homepage")
* @Route("/{page}", name="homepage")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pozor na tohle, http://localhost:8000/a ti spadne

@vasekboch vasekboch changed the title Pagination on homepage Úkol 2 - Vojtěch Havlíček Oct 16, 2016
@@ -23,6 +23,21 @@
# Dump of table category
# ------------------------------------------------------------

DROP TABLE IF EXISTS `category`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Právě kvůli tomu slouží bin/console doctrine:schema:create a bin/console doctrine:schema:drop. To ti umožňuje vždy generovat správnou strukturu DB a tohle ti potom jen naplní daty tabulky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants