Skip to content

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

Open
spitd1 wants to merge 2 commits intoczcodecamp:masterfrom
spitd1:strankovani
Open

Úkol 2 - Vojtěch Havlíček#22
spitd1 wants to merge 2 commits intoczcodecamp:masterfrom
spitd1:strankovani

Conversation

@spitd1
Copy link
Copy Markdown

@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
Copy Markdown
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

<ul class="nav navbar-nav">
<li>
<a href="{{ path("homepage") }}">Domů</a>
<a href="{{ path("homepage", {"page":1}) }}">Domů</a>
Copy link
Copy Markdown
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á

public function homepageAction()
public function homepageAction(Request $request)
{
$perPage = 6;
Copy link
Copy Markdown
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
Copy Markdown
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é...

{
/**
* @Route("/", name="homepage")
* @Route("/{page}", name="homepage")
Copy link
Copy Markdown
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
Comment thread data.sql
# Dump of table category
# ------------------------------------------------------------

DROP TABLE IF EXISTS `category`;
Copy link
Copy Markdown
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.

3 participants