-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: master
Are you sure you want to change the base?
Conversation
for simple import to fresh database (through phpmyadmin, etc)
6 products per page by default
There was a problem hiding this 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> |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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([]); |
There was a problem hiding this comment.
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 <[email protected]> | ||
*/ | ||
class HomepageController extends Controller | ||
{ | ||
/** | ||
* @Route("/", name="homepage") | ||
* @Route("/{page}", name="homepage") |
There was a problem hiding this comment.
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
@@ -23,6 +23,21 @@ | |||
# Dump of table category | |||
# ------------------------------------------------------------ | |||
|
|||
DROP TABLE IF EXISTS `category`; |
There was a problem hiding this comment.
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.
6 products per page by default