Skip to content
Snippets Groups Projects
Commit 1676ef60 authored by Zahdi's avatar Zahdi
Browse files

[Progress] minor changes

parent e60d88b2
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ config/secrets/prod/prod.decrypt.private.php ...@@ -6,7 +6,7 @@ config/secrets/prod/prod.decrypt.private.php
public/bundles/ public/bundles/
var/ var/
vendor/ vendor/
docker/
.idea/ .idea/
docker/server
migrations/ migrations/
public/uploads public/uploads
\ No newline at end of file
version: "3.8"
services:
db:
image: mysql:8.1.0
container_name: db_docker_symfony
restart: always
volumes:
- ./server/mysql_data:/var/lib/mysql #this line maps the content of ./server/mysql_data in your pc to the /var/lib/mysql of the container
ports:
- 3306:3306
environment:
MYSQL_ROOT_USER: 'root'
MYSQL_ROOT_PASSWORD: 'root'
networks:
- dev
phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin_docker_symfony
restart: always
depends_on:
- db
ports:
- 8080:80
environment:
PMA_HOST: db
networks:
- dev
maildev:
image: maildev/maildev
container_name: maildev_docker_symfony
command: bin/maildev --web 80 --smtp 25 --hide-extensions STARTTLS
ports:
- "8081:80"
restart: always
networks:
- dev
www:
build: php
container_name: www_docker_symfony
ports:
- "8000:8000"
volumes:
- ./php/vhosts:/etc/apache2/sites-enabled
- ../:/var/www
restart: always
networks:
- dev
networks:
dev:
FROM php:8.2-apache
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales apt-utils git libicu-dev g++ libpng-dev libxml2-dev libzip-dev libonig-dev libxslt-dev unzip
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen
RUN curl -sS https://getcomposer.org/installer | php -- \
&& mv composer.phar /usr/local/bin/composer
RUN curl -sS https://get.symfony.com/cli/installer | bash \
&& mv /root/.symfony5/bin/symfony /usr/local/bin/symfony
RUN docker-php-ext-configure intl
RUN docker-php-ext-install pdo pdo_mysql opcache intl zip calendar dom mbstring gd xsl
RUN pecl install apcu && docker-php-ext-enable apcu
WORKDIR /var/www/
\ No newline at end of file
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/project/public
DirectoryIndex /index.php
<Directory /var/www/project/public>
AllowOverride None
Order Allow,Deny
Allow from All
FallbackResource /index.php
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
# optionally disable the fallback resource for the asset directories
# which will allow Apache to return a 404 error when files are
# not found instead of passing the request to Symfony
<Directory /var/www/project/public/bundles>
FallbackResource disabled
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
# optionally set the value of the environment variables used in the application
#SetEnv APP_ENV prod
#SetEnv APP_SECRET <app-secret-id>
#SetEnv DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name"
</VirtualHost>
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\Wishlist; use App\Entity\Wishlist;
use DateTime;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
...@@ -13,9 +14,49 @@ class WishlistRepository extends ServiceEntityRepository ...@@ -13,9 +14,49 @@ class WishlistRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, Wishlist::class); parent::__construct( $registry, Wishlist::class);
}
public function findByID($id) {
return $this->find($id);
} }
public function addWishlist(Wishlist $wishlist) {
$this->getEntityManager()->persist($wishlist) ;
$this->getEntityManager()->flush();
}
public function removeWishlist(int $wishlistId) {
$wishlist = $this->find($wishlistId);
if ($wishlist) {
$this->getEntityManager()->remove($wishlist);
$this->getEntityManager()->flush();
}
}
public function editWishList(int $wishlistId, string $name, DateTime $deadline) {
$wishlist = $this->find($wishlistId);
if ($wishlist) {
$wishlist->setName($name);
$wishlist->setDeadline($deadline);
$this->getEntityManager()->flush();
}
}
public function mostExpensiveList() {
$wishlists = $this->findAll() ;
foreach ($wishlists as $wishlist) {
$items = $wishlist->getItems();
}
}
// /** // /**
// * @return Wishlist[] Returns an array of Wishlist objects // * @return Wishlist[] Returns an array of Wishlist objects
// */ // */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment