listing products by category

This commit is contained in:
Ty Kayn 2018-03-15 16:31:12 +01:00
parent ac1c0597ba
commit 6ebeeb723f
10 changed files with 295 additions and 117 deletions

View File

@ -91,6 +91,8 @@
<path value="$PROJECT_DIR$/vendor/symfony/dependency-injection" /> <path value="$PROJECT_DIR$/vendor/symfony/dependency-injection" />
<path value="$PROJECT_DIR$/vendor/symfony/browser-kit" /> <path value="$PROJECT_DIR$/vendor/symfony/browser-kit" />
<path value="$PROJECT_DIR$/vendor/symfony/validator" /> <path value="$PROJECT_DIR$/vendor/symfony/validator" />
<path value="$PROJECT_DIR$/vendor/doctrine/data-fixtures" />
<path value="$PROJECT_DIR$/vendor/doctrine/doctrine-fixtures-bundle" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7" /> <component name="PhpProjectSharedConfiguration" php_language_level="7" />

View File

@ -9,9 +9,11 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/collections" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/collections" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/common" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/common" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/data-fixtures" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-bundle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-cache-bundle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-cache-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-fixtures-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-migrations-bundle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-migrations-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" /> <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />

View File

@ -2,10 +2,15 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="77eba199-b6d3-40aa-8673-48ccff359364" name="Default" comment=""> <list default="true" id="77eba199-b6d3-40aa-8673-48ccff359364" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/php.xml" afterPath="$PROJECT_DIR$/.idea/php.xml" />
<change beforePath="$PROJECT_DIR$/.idea/sf4-test.iml" afterPath="$PROJECT_DIR$/.idea/sf4-test.iml" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/src/Entity/Product.php" afterPath="$PROJECT_DIR$/src/Entity/Product.php" /> <change beforePath="$PROJECT_DIR$/composer.json" afterPath="$PROJECT_DIR$/composer.json" />
<change beforePath="$PROJECT_DIR$/src/Entity/ProductCategory.php" afterPath="$PROJECT_DIR$/src/Entity/ProductCategory.php" /> <change beforePath="$PROJECT_DIR$/composer.lock" afterPath="$PROJECT_DIR$/composer.lock" />
<change beforePath="$PROJECT_DIR$/src/Entity/SellRecord.php" afterPath="$PROJECT_DIR$/src/Entity/SellRecord.php" /> <change beforePath="$PROJECT_DIR$/config/bundles.php" afterPath="$PROJECT_DIR$/config/bundles.php" />
<change beforePath="$PROJECT_DIR$/src/Controller/ProductController.php" afterPath="$PROJECT_DIR$/src/Controller/ProductController.php" />
<change beforePath="$PROJECT_DIR$/symfony.lock" afterPath="$PROJECT_DIR$/symfony.lock" />
<change beforePath="$PROJECT_DIR$/templates/product/index.html.twig" afterPath="$PROJECT_DIR$/templates/product/index.html.twig" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -29,23 +34,23 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="console" pinned="false" current-in-tab="false"> <file leaf-file-name="ProductController.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/bin/console"> <entry file="file://$PROJECT_DIR$/src/Controller/ProductController.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1560"> <state relative-caret-position="390">
<caret line="3" column="4" lean-forward="false" selection-start-line="3" selection-start-column="4" selection-end-line="3" selection-end-column="4" /> <caret line="30" column="48" lean-forward="false" selection-start-line="30" selection-start-column="48" selection-end-line="30" selection-end-column="48" />
<folding> <folding>
<element signature="e#26#41#0#PHP" expanded="true" /> <element signature="e#906#931#0#PHP" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="Product.php" pinned="false" current-in-tab="false"> <file leaf-file-name="index.html.twig" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Entity/Product.php"> <entry file="file://$PROJECT_DIR$/templates/product/index.html.twig">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="453"> <state relative-caret-position="0">
<caret line="31" column="45" lean-forward="false" selection-start-line="31" selection-start-column="45" selection-end-line="31" selection-end-column="45" /> <caret line="0" column="21" lean-forward="false" selection-start-line="0" selection-start-column="21" selection-end-line="0" selection-end-column="21" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -54,8 +59,8 @@
<file leaf-file-name="base.html.twig" pinned="false" current-in-tab="false"> <file leaf-file-name="base.html.twig" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/templates/base.html.twig"> <entry file="file://$PROJECT_DIR$/templates/base.html.twig">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="650"> <state relative-caret-position="910">
<caret line="10" column="36" lean-forward="false" selection-start-line="10" selection-start-column="36" selection-end-line="10" selection-end-column="36" /> <caret line="14" column="7" lean-forward="false" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -64,28 +69,8 @@
<file leaf-file-name="ProductCategory.php" pinned="false" current-in-tab="false"> <file leaf-file-name="ProductCategory.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php"> <entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="388"> <state relative-caret-position="1098">
<caret line="25" column="22" lean-forward="false" selection-start-line="25" selection-start-column="22" selection-end-line="25" selection-end-column="22" /> <caret line="28" column="20" lean-forward="false" selection-start-line="28" selection-start-column="20" selection-end-line="28" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name=".env" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="520">
<caret line="22" column="61" lean-forward="false" selection-start-line="22" selection-start-column="61" selection-end-line="22" selection-end-column="61" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="doctrine.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config/packages/doctrine.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-195">
<caret line="12" column="24" lean-forward="false" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="24" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -108,12 +93,13 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/src/Controller/ProductController.php" />
<option value="$PROJECT_DIR$/templates/base.html.twig" /> <option value="$PROJECT_DIR$/templates/base.html.twig" />
<option value="$PROJECT_DIR$/.env" /> <option value="$PROJECT_DIR$/.env" />
<option value="$PROJECT_DIR$/src/Entity/Product.php" /> <option value="$PROJECT_DIR$/src/Entity/Product.php" />
<option value="$PROJECT_DIR$/src/Entity/ProductCategory.php" /> <option value="$PROJECT_DIR$/src/Entity/ProductCategory.php" />
<option value="$PROJECT_DIR$/src/Entity/SellRecord.php" /> <option value="$PROJECT_DIR$/src/Entity/SellRecord.php" />
<option value="$PROJECT_DIR$/templates/product/index.html.twig" />
<option value="$PROJECT_DIR$/src/Controller/ProductController.php" />
</list> </list>
</option> </option>
</component> </component>
@ -128,6 +114,9 @@
<component name="NodeModulesDirectoryManager"> <component name="NodeModulesDirectoryManager">
<handled-path value="$PROJECT_DIR$/node_modules" /> <handled-path value="$PROJECT_DIR$/node_modules" />
</component> </component>
<component name="PhpServers">
<servers />
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" interpreter_name="PHP 5.5"> <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" interpreter_name="PHP 5.5">
<include_path> <include_path>
<path value="$PROJECT_DIR$/vendor/symfony/dom-crawler" /> <path value="$PROJECT_DIR$/vendor/symfony/dom-crawler" />
@ -219,6 +208,8 @@
<path value="$PROJECT_DIR$/vendor/symfony/dependency-injection" /> <path value="$PROJECT_DIR$/vendor/symfony/dependency-injection" />
<path value="$PROJECT_DIR$/vendor/symfony/browser-kit" /> <path value="$PROJECT_DIR$/vendor/symfony/browser-kit" />
<path value="$PROJECT_DIR$/vendor/symfony/validator" /> <path value="$PROJECT_DIR$/vendor/symfony/validator" />
<path value="$PROJECT_DIR$/vendor/doctrine/data-fixtures" />
<path value="$PROJECT_DIR$/vendor/doctrine/doctrine-fixtures-bundle" />
</include_path> </include_path>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
@ -273,6 +264,19 @@
<item name="config" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="config" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="packages" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="packages" type="2a2b976b:PhpTreeStructureProvider$1" />
</path> </path>
<path>
<item name="sf4-test" type="b2602c69:ProjectViewProjectNode" />
<item name="sf4-test" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="config" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="routes" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="sf4-test" type="b2602c69:ProjectViewProjectNode" />
<item name="sf4-test" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="config" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="routes" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="dev" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path> <path>
<item name="sf4-test" type="b2602c69:ProjectViewProjectNode" /> <item name="sf4-test" type="b2602c69:ProjectViewProjectNode" />
<item name="sf4-test" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="sf4-test" type="2a2b976b:PhpTreeStructureProvider$1" />
@ -364,22 +368,23 @@
<updated>1520949897852</updated> <updated>1520949897852</updated>
<workItem from="1520949899279" duration="654000" /> <workItem from="1520949899279" duration="654000" />
<workItem from="1521124630756" duration="815000" /> <workItem from="1521124630756" duration="815000" />
<workItem from="1521125457191" duration="1508000" /> <workItem from="1521125457191" duration="2395000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2977000" /> <option name="totallyTimeSpent" value="3864000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="1046" y="436" width="3761" height="2166" extended-state="6" /> <frame x="1046" y="436" width="3761" height="2166" extended-state="6" />
<editor active="true" />
<layout> <layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32984293" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.124828905" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.124828905" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
@ -534,14 +539,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/config/packages/routing.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/packages/twig.yaml"> <entry file="file://$PROJECT_DIR$/config/packages/twig.yaml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
@ -598,34 +595,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Controller/ProductController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="581">
<caret line="33" column="43" lean-forward="false" selection-start-line="33" selection-start-column="43" selection-end-line="33" selection-end-column="43" />
<folding>
<element signature="e#34#57#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/product/index.html.twig">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#12#26#0#Twig" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/base.html.twig">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="650">
<caret line="10" column="36" lean-forward="false" selection-start-line="10" selection-start-column="36" selection-end-line="10" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Repository/SellRecordRepository.php"> <entry file="file://$PROJECT_DIR$/src/Repository/SellRecordRepository.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-780"> <state relative-caret-position="-780">
@ -642,20 +611,34 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/bin/console"> <entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1560"> <state relative-caret-position="455">
<caret line="3" column="4" lean-forward="false" selection-start-line="3" selection-start-column="4" selection-end-line="3" selection-end-column="4" /> <caret line="21" column="47" lean-forward="false" selection-start-line="21" selection-start-column="47" selection-end-line="21" selection-end-column="47" />
<folding> <folding />
<element signature="e#26#41#0#PHP" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php"> <entry file="file://$PROJECT_DIR$/config/packages/routing.yaml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="388"> <state relative-caret-position="0">
<caret line="25" column="22" lean-forward="false" selection-start-line="25" selection-start-column="22" selection-end-line="25" selection-end-column="22" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/routes/dev/twig.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/routes/annotations.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -668,6 +651,16 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/bin/console">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1560">
<caret line="3" column="4" lean-forward="false" selection-start-line="3" selection-start-column="4" selection-end-line="3" selection-end-column="4" />
<folding>
<element signature="e#26#41#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Entity/SellRecord.php"> <entry file="file://$PROJECT_DIR$/src/Entity/SellRecord.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="650"> <state relative-caret-position="650">
@ -676,13 +669,39 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/.env"> <entry file="file://$PROJECT_DIR$/src/Entity/ProductCategory.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="520"> <state relative-caret-position="1098">
<caret line="22" column="61" lean-forward="false" selection-start-line="22" selection-start-column="61" selection-end-line="22" selection-end-column="61" /> <caret line="28" column="20" lean-forward="false" selection-start-line="28" selection-start-column="20" selection-end-line="28" selection-end-column="20" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/templates/product/index.html.twig">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="21" lean-forward="false" selection-start-line="0" selection-start-column="21" selection-end-line="0" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/templates/base.html.twig">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="910">
<caret line="14" column="7" lean-forward="false" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Controller/ProductController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="390">
<caret line="30" column="48" lean-forward="false" selection-start-line="30" selection-start-column="48" selection-end-line="30" selection-end-column="48" />
<folding>
<element signature="e#906#931#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View File

@ -25,6 +25,7 @@
"symfony/yaml": "^3.4" "symfony/yaml": "^3.4"
}, },
"require-dev": { "require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"symfony/browser-kit": "^3.4", "symfony/browser-kit": "^3.4",
"symfony/css-selector": "^3.4", "symfony/css-selector": "^3.4",
"symfony/dotenv": "^3.4", "symfony/dotenv": "^3.4",

122
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f622f00afd59c3a14e9d36ccff4cdc4e", "content-hash": "ed6ed212a7401fdb77a64ea454462831",
"packages": [ "packages": [
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -5232,6 +5232,126 @@
} }
], ],
"packages-dev": [ "packages-dev": [
{
"name": "doctrine/data-fixtures",
"version": "v1.2.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/data-fixtures.git",
"reference": "17fa5bfe6ff52e35cb3d9ec37c934a2f4bd1fa2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/17fa5bfe6ff52e35cb3d9ec37c934a2f4bd1fa2e",
"reference": "17fa5bfe6ff52e35cb3d9ec37c934a2f4bd1fa2e",
"shasum": ""
},
"require": {
"doctrine/common": "~2.2",
"php": "^5.6 || ^7.0"
},
"conflict": {
"doctrine/orm": "< 2.4"
},
"require-dev": {
"doctrine/dbal": "^2.5.4",
"doctrine/orm": "^2.5.4",
"phpunit/phpunit": "^5.4.6"
},
"suggest": {
"doctrine/mongodb-odm": "For loading MongoDB ODM fixtures",
"doctrine/orm": "For loading ORM fixtures",
"doctrine/phpcr-odm": "For loading PHPCR ODM fixtures"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\DataFixtures": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Data Fixtures for all Doctrine Object Managers",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"database"
],
"time": "2016-09-20T10:07:57+00:00"
},
{
"name": "doctrine/doctrine-fixtures-bundle",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
"reference": "7fc29d2b18c61ed99826b21fbfd1ff9969cc2e7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/7fc29d2b18c61ed99826b21fbfd1ff9969cc2e7f",
"reference": "7fc29d2b18c61ed99826b21fbfd1ff9969cc2e7f",
"shasum": ""
},
"require": {
"doctrine/data-fixtures": "~1.0",
"doctrine/doctrine-bundle": "~1.0",
"php": ">=5.5.9|^7.0",
"symfony/doctrine-bridge": "~2.7|~3.0|~4.0",
"symfony/framework-bundle": "^3.3|^4.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.3"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Bundle\\FixturesBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Doctrine Project",
"homepage": "http://www.doctrine-project.org"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony DoctrineFixturesBundle",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"Fixture",
"persistence"
],
"time": "2017-12-04T20:26:38+00:00"
},
{ {
"name": "symfony/browser-kit", "name": "symfony/browser-kit",
"version": "v3.4.6", "version": "v3.4.6",

View File

@ -13,4 +13,5 @@ return [
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
]; ];

View File

@ -3,37 +3,32 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\Product; use App\Entity\Product;
use App\Entity\ProductCategory;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ProductController extends Controller { class ProductController extends Controller {
/** /**
* @Route("/product", name="product") * @Route("/", name="product")
*/ */
public function index() { public function index() {
$allProducts = $this->getDoctrine() $allProducts = $this->getDoctrine()
->getRepository( Product::class ) ->getRepository( Product::class )
->findAll(); ->findAll();
$allCategories = $this->getDoctrine()
->getRepository( ProductCategory::class )
->findAll();
// you can fetch the EntityManager via $this->getDoctrine() // you can fetch the EntityManager via $this->getDoctrine()
// or you can add an argument to your action: index(EntityManagerInterface $entityManager) // or you can add an argument to your action: index(EntityManagerInterface $entityManager)
$entityManager = $this->getDoctrine()->getManager(); // $entityManager = $this->getDoctrine()->getManager();
$product = new Product();
$product->setName( 'qzine n°spécial 1' );
$product->setPrice( 19.99 );
// tell Doctrine you want to (eventually) save the Product (no queries yet)
$entityManager->persist( $product );
// actually executes the queries (i.e. the INSERT query)
$entityManager->flush();
// return new Response( 'Saved new product with id ' . $product->getId() ); // return new Response( 'Saved new product with id ' . $product->getId() );
return $this->render( 'product/index.html.twig', return $this->render( 'product/index.html.twig',
[ [
'product' => $product, 'categories' => $allCategories,
'allProducts' => $allProducts, 'allProducts' => $allProducts,
] ); ] );
} }

0
src/DataFixtures/.gitignore vendored Normal file
View File

View File

@ -17,6 +17,9 @@
"doctrine/common": { "doctrine/common": {
"version": "v2.7.3" "version": "v2.7.3"
}, },
"doctrine/data-fixtures": {
"version": "v1.2.2"
},
"doctrine/dbal": { "doctrine/dbal": {
"version": "v2.5.13" "version": "v2.5.13"
}, },
@ -32,6 +35,15 @@
"doctrine/doctrine-cache-bundle": { "doctrine/doctrine-cache-bundle": {
"version": "1.3.2" "version": "1.3.2"
}, },
"doctrine/doctrine-fixtures-bundle": {
"version": "3.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.0",
"ref": "2ea6070ecf365f9a801ccaed4b31d4a3b7af5693"
}
},
"doctrine/doctrine-migrations-bundle": { "doctrine/doctrine-migrations-bundle": {
"version": "1.2", "version": "1.2",
"recipe": { "recipe": {

View File

@ -1,20 +1,46 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block title %}Hello {{ controller_name }}!{% endblock %} {% block title %}Hello !{% endblock %}
{% block body %} {% block body %}
<style> <style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } .example-wrapper {
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; } margin: 1em auto;
</style> max-width: 800px;
width: 95%;
font: 18px/1.5 sans-serif;
}
<div class="example-wrapper"> .example-wrapper code {
<h1>Hello {{ controller_name }}! ✅</h1> background: #F5F5F5;
padding: 2px 6px;
}
</style>
<div class="example-wrapper">
<h1>Hello ! ✅</h1>
<fieldset>
<h2>
Catégories
</h2>
{% for c in categories %}
<h3>{{ c.name }}</h3>
{% for p in c.products %}
<button class="btn btn-default">
{{ p.name }}
</button>
{% endfor %}
{% endfor %}
</fieldset>
<footer>
This friendly message is coming from: This friendly message is coming from:
<ul> <ul>
<li>Your controller at <code>src/Controller/ProductController.php</code></li> <li>Your controller at <code>src/Controller/ProductController.php</code></li>
<li>Your template at <code>templates/product/index.html.twig</code></li> <li>Your template at <code>templates/product/index.html.twig</code></li>
</ul> </ul>
</div> </footer>
</div>
{% endblock %} {% endblock %}