Add image in fixtures (#699)

* Add image in fixtures

* Add storage directory in gitignore

* Add pictures for user, categories. Add upload system to service product

* restore gitignore
This commit is contained in:
maxiloud 2024-03-18 10:46:07 +01:00 committed by Slim Amamou
parent 2b6245344d
commit 28acad23be
21 changed files with 31 additions and 11 deletions

View file

@ -8,7 +8,6 @@ services:
target: app_php_dev
volumes:
- ./:/srv/app
- storage:/srv/app/public/storage
- ./docker/php/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
# If you develop on Mac or Windows you can remove the vendor/ directory
# from the bind-mount for better performance by enabling the next line:
@ -24,7 +23,6 @@ services:
caddy:
volumes:
- ./public:/srv/app/public:ro
- storage:/srv/app/public/storage
- ./docker/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
maildev:

View file

@ -26,6 +26,7 @@ App\Entity\Category:
category_service_4_0 (extends category_object):
parent: '@category_object_4'
name: Guitare
image: 'de945081-21b6-46c2-864d-db6ed6b43311.png'
category_object_5 (extends category_object):
name: Entretien de la maison
@ -35,6 +36,7 @@ App\Entity\Category:
category_object_7 (extends category_object):
name: Images & son
image: 'd1fdbb3f-a5ca-4019-b488-fe6d8b06a4d3.png'
category_object_8 (extends category_object):
name: Informatique - téléphonie consoles et jeux vidéos
@ -44,12 +46,13 @@ App\Entity\Category:
category_object_10 (extends category_object):
name: Livres
image: '87c1aa88-1937-4a71-b4d9-325086783193.png'
category_object_11 (extends category_object):
name: Loisirs divers
category_object_12 (extends category_object):
name: Matériel de sports
image: '04f41100-e963-4f33-8aaf-f1c774e0d42f.png'
category_object_13 (extends category_object):
name: Matériel de vacances et weekend

View file

@ -43,7 +43,8 @@ App\Entity\Product:
name: Guitare électrique
description: >
Guitare en bon état.
age: 2010
age: 2010
images: ["d51c66ad-9e02-4fa9-8f37-5c84d928226e.jpg"]
loic_service_1 (extends service):
id: <uuid('1ed7a2a8-0a78-605a-a8e0-f3a729006754')>
@ -53,7 +54,8 @@ App\Entity\Product:
description: >
Initiation aux échecs pour débutants (1 heure).
duration: >
Une ou deux heures si besoin.
Une ou deux heures si besoin.
images: ["e2140911-4689-47df-a9cd-f87cef342cdd.jpg"]
# Kevin ———————————————————————————————————————————————————————————————————
kevin_object_1 (extends object):
@ -64,6 +66,7 @@ App\Entity\Product:
description: >
Très bien pour les déménagements, même proches.
age: Acheté en 2012.
images: ["d4a5f2fb-57bb-4e6a-95eb-0614e8f62d45.jpg"]
kevin_object_2 (extends object):
owner: '@admin_kevin'
@ -72,6 +75,7 @@ App\Entity\Product:
description: >
Très bien pour percer des trous dans la maison.
age: Acheté en 2015.
images: ["d75f07b1-52cb-4e39-929d-9da35e722627.jpg"]
# Camille —————————————————————————————————————————————————————————————————————
camille_object_1 (extends object):
@ -109,6 +113,7 @@ App\Entity\Product:
Pour transporter son enfant ou son chat.
age: 2022
deposit: 5000
images: ["335dbbc1-3660-4f82-a529-fe79eb1a9a87.jpg"]
# user 16 —————————————————————————————————————————————————————————————————————
user_16_service_1 (extends service):
@ -129,6 +134,7 @@ App\Entity\Product:
Très belle guitare électrique en bon état.
age: 2013
deposit: 2000
images: ["e5889470-abfd-432c-aa96-0838608b936a.jpg"]
user_16_object_2 (extends object):
owner: '@user_16'
@ -136,7 +142,8 @@ App\Entity\Product:
name: Piano
description: >
Piano en bon état.
age: 2010
age: 2010
images: ["f3fa0285-2b3c-4235-a618-9092ee55cae4.jpg"]
# place apes —————————————————————————————————————————————————————————————————————
place_apes_service_1 (extends service):
@ -163,7 +170,8 @@ App\Entity\Product:
description: >
Cours de rattrapage en histoire, aide aux devoirs, remise à niveau.
duration: >
Une journée.
Une journée.
images: ["c594de44-8999-46ed-89f0-6688c7d7c087.jpg"]
# Place 6 ———————————————————————————————————————————————————————————————————
place_6_object_1 (extends object):
@ -175,6 +183,7 @@ App\Entity\Product:
duration: Une journée.
age: De 2 à 10 ans
deposit: 0
images: ["434a9bb7-c140-4776-93e8-b8d018cd28f0.jpg"]
place_6_object_2 (extends object):
id: <uuid('1edf938b-7344-6684-87d5-d36fc869cf92')>

View file

@ -25,6 +25,7 @@ App\Entity\User:
lastname: 'Croteau'
mainAdminAccount: true
address: '@address_camille'
avatar: 'a9a9bf49-24e4-4b3e-bdbd-86808c32939e.jpg'
admin_loic (extends admin_template):
id: <uuid('1ed674d3-886f-6ad4-bc25-15f868662c0c')>
@ -33,12 +34,14 @@ App\Entity\User:
lastname: 'Duclos'
devAccount: true
address: '@address_loic'
avatar: '7c732ddb-9c13-45eb-aea0-e614f2340e6d.jpg'
admin_kevin (extends admin_template):
id: <uuid('1ed69804-eeb9-6c32-990b-632c3a6846ba')>
email: 'kevin@example.com'
firstname: 'Kevin'
lastname: 'Pirouet'
avatar: '7c732ddb-9c13-45eb-aea0-e614f2340e6d.jpg'
admin_apes (extends admin_template):
id: <uuid('1ed69804-eeb9-6e6c-bce0-632c3a6846ba')>
@ -55,6 +58,7 @@ App\Entity\User:
devAccount: true
address: '@address_region_hauts_de_france'
category: '@category_object_16'
avatar: 'a9a9bf49-24e4-4b3e-bdbd-86808c32939e.jpg'
# —— Places ————————————————————————————————————————————————————————————————
place_{6} (extends place_template):
@ -156,7 +160,7 @@ App\Entity\User:
firstname: <firstname()>
lastname: <lastname()>
address: null
avatar: 'ba827ea0-b140-4cbf-9786-77ac980c648c.jpg'
avatar: 'a9a9bf49-24e4-4b3e-bdbd-86808c32939e.jpg'
# user with an address and a preferred category set
user_{17} (extends user_template):
@ -173,3 +177,4 @@ App\Entity\User:
email: 'john.doe@example.com'
firstname: 'John'
lastname: 'Doe'
avatar: '7c732ddb-9c13-45eb-aea0-e614f2340e6d.jpg'

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View file

@ -10,6 +10,7 @@ use App\Enum\Product\ProductType;
use App\Enum\Product\ProductVisibility;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
/**
* Specific page for services.
@ -53,15 +54,19 @@ final class ServiceCrudController extends AbstractProductCrudController
'nameField' => $nameField,
'descriptionField' => $descriptionField,
'durationField' => $durationField,
'imageField' => $imageField,
'createdAt' => $createdAt,
'updatedAt' => $updatedAt,
] = $this->getFields($pageName);
// list
if ($pageName === Crud::PAGE_INDEX) {
return [$nameField, $ownerField, $categoryField, $statusField, $visibilityField, $createdAt];
return [$nameField, $ownerField, $categoryField, $statusField, $visibilityField, $imageField, $createdAt];
}
/** @var ImageField $imageField */
$imageField->setCustomOption('first_image_only', false);
// forms
if ($pageName === Crud::PAGE_NEW || $pageName === Crud::PAGE_EDIT) {
/** @var ChoiceField $statusField */
@ -69,7 +74,7 @@ final class ServiceCrudController extends AbstractProductCrudController
/** @var ChoiceField $visibilityField */
$visibilityField->setChoices(ProductVisibility::cases());
return [$nameField, $ownerField, $categoryField, $statusField, $visibilityField, $descriptionField, $durationField];
return [$nameField, $ownerField, $categoryField, $statusField, $visibilityField, $descriptionField, $imageField, $durationField];
}
// detail
@ -83,7 +88,7 @@ final class ServiceCrudController extends AbstractProductCrudController
$nameField,
$descriptionField,
$durationField,
$imageField,
$panels['tech_information'],
$idField,
$typeField,