before upgrading to 7

This commit is contained in:
ayman
2025-10-05 19:48:16 +01:00
parent 1bf9a8a8b2
commit 154b1fef82
18 changed files with 278 additions and 176 deletions

1
.env
View File

@@ -15,6 +15,7 @@
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_DEBUG=1
APP_ENV=dev
APP_SECRET=3cca434f1ec9b1671c12ec4e42f91e19
###< symfony/framework-bundle ###

View File

@@ -68,6 +68,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/type-info" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-dumper" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-exporter" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/web-profiler-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/yaml" />
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
</content>

1
.idea/php.xml generated
View File

@@ -78,6 +78,7 @@
<path value="$PROJECT_DIR$/vendor/symfony/security-bundle" />
<path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/symfony/security-core" />
<path value="$PROJECT_DIR$/vendor/symfony/web-profiler-bundle" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.2">

View File

@@ -1,7 +1,7 @@
{
"name": "appsynchq/expenses",
"type": "project",
"description": "Expenses app migrated to Symfony 6.4",
"description": "Expenses app migrated to Symfony 6.4 LTS",
"license": "MIT",
"require": {
"php": ">=8.1",
@@ -12,15 +12,16 @@
"symfony/dependency-injection": "^6.4",
"symfony/yaml": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/runtime": "^7.3",
"symfony/console": "6.4.*",
"symfony/security-bundle": "^7.3",
"symfony/runtime": "^6.4",
"symfony/console": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/orm-pack": "^2.4",
"symfony/dotenv": "^7.3"
"symfony/dotenv": "^6.4"
},
"require-dev": {
"symfony/var-dumper": "^6.4",
"symfony/maker-bundle": "^1.64"
"symfony/maker-bundle": "^1.64",
"symfony/web-profiler-bundle": "^6.4"
},
"autoload": {
"psr-4": {
@@ -29,17 +30,11 @@
},
"scripts": {
"post-install-cmd": [
"@php bin/console cache:clear || exit 0",
"@auto-scripts"
"@php bin/console cache:clear || exit 0"
],
"post-update-cmd": [
"@php bin/console cache:clear || exit 0",
"@auto-scripts"
],
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
"@php bin/console cache:clear || exit 0"
]
},
"config": {
"allow-plugins": {

218
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c7aa509e99c2451247ade877790699c8",
"content-hash": "17a1dad19087daaf353134d6e01f7342",
"packages": [
{
"name": "doctrine/collections",
@@ -2076,28 +2076,28 @@
},
{
"name": "symfony/dotenv",
"version": "v7.3.2",
"version": "v6.4.24",
"source": {
"type": "git",
"url": "https://github.com/symfony/dotenv.git",
"reference": "2192790a11f9e22cbcf9dc705a3ff22a5503923a"
"reference": "234b6c602f12b00693f4b0d1054386fb30dfc8ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dotenv/zipball/2192790a11f9e22cbcf9dc705a3ff22a5503923a",
"reference": "2192790a11f9e22cbcf9dc705a3ff22a5503923a",
"url": "https://api.github.com/repos/symfony/dotenv/zipball/234b6c602f12b00693f4b0d1054386fb30dfc8ff",
"reference": "234b6c602f12b00693f4b0d1054386fb30dfc8ff",
"shasum": ""
},
"require": {
"php": ">=8.2"
"php": ">=8.1"
},
"conflict": {
"symfony/console": "<6.4",
"symfony/process": "<6.4"
"symfony/console": "<5.4",
"symfony/process": "<5.4"
},
"require-dev": {
"symfony/console": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0"
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/process": "^5.4|^6.0|^7.0"
},
"type": "library",
"autoload": {
@@ -2130,7 +2130,7 @@
"environment"
],
"support": {
"source": "https://github.com/symfony/dotenv/tree/v7.3.2"
"source": "https://github.com/symfony/dotenv/tree/v6.4.24"
},
"funding": [
{
@@ -2150,7 +2150,7 @@
"type": "tidelift"
}
],
"time": "2025-07-10T08:29:33+00:00"
"time": "2025-07-10T08:14:14+00:00"
},
{
"name": "symfony/error-handler",
@@ -3758,31 +3758,31 @@
},
{
"name": "symfony/runtime",
"version": "v7.3.4",
"version": "v6.4.26",
"source": {
"type": "git",
"url": "https://github.com/symfony/runtime.git",
"reference": "3550e2711e30bfa5d808514781cd52d1cc1d9e9f"
"reference": "59933ca737fd60fad548241b6d879cd0e4be31ab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/runtime/zipball/3550e2711e30bfa5d808514781cd52d1cc1d9e9f",
"reference": "3550e2711e30bfa5d808514781cd52d1cc1d9e9f",
"url": "https://api.github.com/repos/symfony/runtime/zipball/59933ca737fd60fad548241b6d879cd0e4be31ab",
"reference": "59933ca737fd60fad548241b6d879cd0e4be31ab",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0|^2.0",
"php": ">=8.2"
"php": ">=8.1"
},
"conflict": {
"symfony/dotenv": "<6.4"
"symfony/dotenv": "<5.4"
},
"require-dev": {
"composer/composer": "^2.6",
"symfony/console": "^6.4|^7.0",
"symfony/dotenv": "^6.4|^7.0",
"symfony/http-foundation": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0"
"composer/composer": "^1.0.2|^2.0",
"symfony/console": "^5.4.9|^6.0.9|^7.0",
"symfony/dotenv": "^5.4|^6.0|^7.0",
"symfony/http-foundation": "^5.4|^6.0|^7.0",
"symfony/http-kernel": "^5.4|^6.0|^7.0"
},
"type": "composer-plugin",
"extra": {
@@ -3817,7 +3817,7 @@
"runtime"
],
"support": {
"source": "https://github.com/symfony/runtime/tree/v7.3.4"
"source": "https://github.com/symfony/runtime/tree/v6.4.26"
},
"funding": [
{
@@ -3837,69 +3837,75 @@
"type": "tidelift"
}
],
"time": "2025-09-11T15:31:28+00:00"
"time": "2025-09-11T15:30:54+00:00"
},
{
"name": "symfony/security-bundle",
"version": "v7.3.4",
"version": "v6.4.26",
"source": {
"type": "git",
"url": "https://github.com/symfony/security-bundle.git",
"reference": "f750d9abccbeaa433c56f6a4eb2073166476a75a"
"reference": "b83773107a5b83a5507df9e88bd50d495f6e8b72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/security-bundle/zipball/f750d9abccbeaa433c56f6a4eb2073166476a75a",
"reference": "f750d9abccbeaa433c56f6a4eb2073166476a75a",
"url": "https://api.github.com/repos/symfony/security-bundle/zipball/b83773107a5b83a5507df9e88bd50d495f6e8b72",
"reference": "b83773107a5b83a5507df9e88bd50d495f6e8b72",
"shasum": ""
},
"require": {
"composer-runtime-api": ">=2.1",
"ext-xml": "*",
"php": ">=8.2",
"symfony/clock": "^6.4|^7.0",
"symfony/config": "^7.3",
"php": ">=8.1",
"symfony/clock": "^6.3|^7.0",
"symfony/config": "^6.1|^7.0",
"symfony/dependency-injection": "^6.4.11|^7.1.4",
"symfony/event-dispatcher": "^6.4|^7.0",
"symfony/http-foundation": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/password-hasher": "^6.4|^7.0",
"symfony/security-core": "^7.3",
"symfony/security-csrf": "^6.4|^7.0",
"symfony/security-http": "^7.3",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/http-foundation": "^6.2|^7.0",
"symfony/http-kernel": "^6.2",
"symfony/password-hasher": "^5.4|^6.0|^7.0",
"symfony/security-core": "^6.2|^7.0",
"symfony/security-csrf": "^5.4|^6.0|^7.0",
"symfony/security-http": "^6.3.6|^7.0",
"symfony/service-contracts": "^2.5|^3"
},
"conflict": {
"symfony/browser-kit": "<6.4",
"symfony/console": "<6.4",
"symfony/browser-kit": "<5.4",
"symfony/console": "<5.4",
"symfony/framework-bundle": "<6.4",
"symfony/http-client": "<6.4",
"symfony/ldap": "<6.4",
"symfony/http-client": "<5.4",
"symfony/ldap": "<5.4",
"symfony/serializer": "<6.4",
"symfony/twig-bundle": "<6.4",
"symfony/twig-bundle": "<5.4",
"symfony/validator": "<6.4"
},
"require-dev": {
"symfony/asset": "^6.4|^7.0",
"symfony/browser-kit": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/css-selector": "^6.4|^7.0",
"symfony/dom-crawler": "^6.4|^7.0",
"symfony/expression-language": "^6.4|^7.0",
"symfony/form": "^6.4|^7.0",
"symfony/asset": "^5.4|^6.0|^7.0",
"symfony/browser-kit": "^5.4|^6.0|^7.0",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/css-selector": "^5.4|^6.0|^7.0",
"symfony/dom-crawler": "^5.4|^6.0|^7.0",
"symfony/expression-language": "^5.4|^6.0|^7.0",
"symfony/form": "^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/http-client": "^6.4|^7.0",
"symfony/ldap": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/rate-limiter": "^6.4|^7.0",
"symfony/http-client": "^5.4|^6.0|^7.0",
"symfony/ldap": "^5.4|^6.0|^7.0",
"symfony/process": "^5.4|^6.0|^7.0",
"symfony/rate-limiter": "^5.4|^6.0|^7.0",
"symfony/serializer": "^6.4|^7.0",
"symfony/translation": "^6.4|^7.0",
"symfony/twig-bridge": "^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0",
"symfony/translation": "^5.4|^6.0|^7.0",
"symfony/twig-bridge": "^5.4|^6.0|^7.0",
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
"symfony/validator": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0",
"twig/twig": "^3.12",
"web-token/jwt-library": "^3.3.2|^4.0"
"symfony/yaml": "^5.4|^6.0|^7.0",
"twig/twig": "^2.13|^3.0.4",
"web-token/jwt-checker": "^3.1",
"web-token/jwt-signature-algorithm-ecdsa": "^3.1",
"web-token/jwt-signature-algorithm-eddsa": "^3.1",
"web-token/jwt-signature-algorithm-hmac": "^3.1",
"web-token/jwt-signature-algorithm-none": "^3.1",
"web-token/jwt-signature-algorithm-rsa": "^3.1"
},
"type": "symfony-bundle",
"autoload": {
@@ -3927,7 +3933,7 @@
"description": "Provides a tight integration of the Security component into the Symfony full-stack framework",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/security-bundle/tree/v7.3.4"
"source": "https://github.com/symfony/security-bundle/tree/v6.4.26"
},
"funding": [
{
@@ -3947,7 +3953,7 @@
"type": "tidelift"
}
],
"time": "2025-09-22T15:31:00+00:00"
"time": "2025-09-22T15:03:07+00:00"
},
{
"name": "symfony/security-core",
@@ -5340,6 +5346,92 @@
}
],
"time": "2025-09-11T10:12:26+00:00"
},
{
"name": "symfony/web-profiler-bundle",
"version": "v6.4.25",
"source": {
"type": "git",
"url": "https://github.com/symfony/web-profiler-bundle.git",
"reference": "4c1754d6b3ffe52e9eaed0d9a392eb43a60fc910"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/4c1754d6b3ffe52e9eaed0d9a392eb43a60fc910",
"reference": "4c1754d6b3ffe52e9eaed0d9a392eb43a60fc910",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/routing": "^5.4|^6.0|^7.0",
"symfony/twig-bundle": "^5.4|^6.0",
"twig/twig": "^2.13|^3.0.4"
},
"conflict": {
"symfony/form": "<5.4",
"symfony/mailer": "<5.4",
"symfony/messenger": "<5.4",
"symfony/twig-bundle": ">=7.0"
},
"require-dev": {
"symfony/browser-kit": "^5.4|^6.0|^7.0",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/css-selector": "^5.4|^6.0|^7.0",
"symfony/stopwatch": "^5.4|^6.0|^7.0"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Symfony\\Bundle\\WebProfilerBundle\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides a development tool that gives detailed information about the execution of any request",
"homepage": "https://symfony.com",
"keywords": [
"dev"
],
"support": {
"source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.25"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-08-07T12:02:05+00:00"
}
],
"aliases": [],

View File

@@ -1,8 +1,9 @@
<?php
return [
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true]
];

View File

@@ -0,0 +1,6 @@
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }

View File

@@ -1,18 +1,21 @@
framework:
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
name: EXPENSES_SESSID
router:
utf8: true
csrf_protection: true
php_errors:
log: true
profiler:
enabled: true
only_exceptions: false
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
name: EXPENSES_SESSID
router:
utf8: true
csrf_protection: true
php_errors:
log: true
when@test:
framework:

View File

@@ -1,71 +1,16 @@
# Routes mapping legacy functionality to Symfony controllers
home:
path: /
controller: App\Controller\PageController::daily
# Routing migrated to PHP attributes on controllers.
# This file is intentionally left without route definitions to avoid duplicates.
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute
expenses_create:
path: /expenses/create
controller: App\Controller\ExpenseController::create
methods: [POST]
kernel:
resource: ../src/Kernel.php
type: annotation
expenses_types:
path: /expenses/types
controller: App\Controller\ExpenseController::types
methods: [GET]
expenses_add_type:
path: /expenses/types/add
controller: App\Controller\ExpenseController::addType
methods: [POST]
expenses_download_csv:
path: /expenses/download.csv
controller: App\Controller\ExpenseController::downloadCsv
methods: [GET]
expenses_list_by_date:
path: /expenses/by-date/{date}
controller: App\Controller\ExpenseController::listByDate
requirements:
date: '\d{4}-\d{2}-\d{2}'
methods: [GET]
expenses_dates_with_expenses:
path: /expenses/dates
controller: App\Controller\ExpenseController::datesWithExpenses
methods: [GET]
# Expense Types Management
manage_types:
path: /types/manage
controller: App\Controller\ExpenseTypeController::manage
methods: [GET]
types_list:
path: /types/list
controller: App\Controller\ExpenseTypeController::list
methods: [GET]
types_add:
path: /types/add
controller: App\Controller\ExpenseTypeController::add
methods: [POST]
types_delete:
path: /types/delete/{id}
controller: App\Controller\ExpenseTypeController::delete
requirements:
id: '\d+'
methods: [DELETE]
register:
path: /register
controller: App\Controller\RegistrationController::register
login:
path: /login
controller: App\Controller\AuthController::login
logout:
path: /logout
controller: App\Controller\AuthController::logout
when@dev:
imports:
resource: routes/dev/
type: directory

View File

@@ -0,0 +1,3 @@
controllers:
resource: ../../src/Controller/
type: attribute

View File

@@ -0,0 +1,7 @@
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View File

@@ -3,6 +3,7 @@ namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Twig\Environment;
@@ -10,6 +11,7 @@ class AuthController extends AbstractController
{
public function __construct(private Environment $twig) {}
#[Route(path: '/login', name: 'login', methods: ['GET','POST'])]
public function login(AuthenticationUtils $authenticationUtils): Response
{
$error = $authenticationUtils->getLastAuthenticationError();
@@ -23,6 +25,7 @@ class AuthController extends AbstractController
return new Response($html);
}
#[Route(path: '/logout', name: 'logout', methods: ['POST','GET'])]
public function logout(): void
{
// This method can be blank - it will be intercepted by the logout key on your firewall.

View File

@@ -8,11 +8,13 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Annotation\Route;
class ExpenseController extends AbstractController
{
public function __construct(private ExpenseService $service) {}
#[Route(path: '/expenses/create', name: 'expenses_create', methods: ['POST'])]
public function create(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -31,6 +33,7 @@ class ExpenseController extends AbstractController
}
}
#[Route(path: '/expenses/types', name: 'expenses_types', methods: ['GET'])]
public function types(): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -39,6 +42,7 @@ class ExpenseController extends AbstractController
return $this->success(['types' => $types]);
}
#[Route(path: '/expenses/types/add', name: 'expenses_add_type', methods: ['POST'])]
public function addType(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -52,6 +56,7 @@ class ExpenseController extends AbstractController
}
}
#[Route(path: '/expenses/by-date/{date}', name: 'expenses_list_by_date', requirements: ['date' => '\\d{4}-\\d{2}-\\d{2}'], methods: ['GET'])]
public function listByDate(string $date): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -61,6 +66,7 @@ class ExpenseController extends AbstractController
return $this->success(['items' => $items, 'date' => $dt->format('Y-m-d')]);
}
#[Route(path: '/expenses/dates', name: 'expenses_dates_with_expenses', methods: ['GET'])]
public function datesWithExpenses(): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -69,6 +75,7 @@ class ExpenseController extends AbstractController
return $this->success(['dates' => $dates]);
}
#[Route(path: '/expenses/download.csv', name: 'expenses_download_csv', methods: ['GET'])]
public function downloadCsv(): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');

View File

@@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Twig\Environment;
class ExpenseTypeController extends AbstractController
@@ -15,6 +16,7 @@ class ExpenseTypeController extends AbstractController
private ExpenseService $service
) {}
#[Route(path: '/types/manage', name: 'manage_types', methods: ['GET'])]
public function manage(): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -28,6 +30,7 @@ class ExpenseTypeController extends AbstractController
return new Response($html);
}
#[Route(path: '/types/list', name: 'types_list', methods: ['GET'])]
public function list(): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -36,6 +39,7 @@ class ExpenseTypeController extends AbstractController
return $this->success(['types' => $types]);
}
#[Route(path: '/types/add', name: 'types_add', methods: ['POST'])]
public function add(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -50,6 +54,7 @@ class ExpenseTypeController extends AbstractController
}
}
#[Route(path: '/types/delete/{id}', name: 'types_delete', requirements: ['id' => '\\d+'], methods: ['DELETE'])]
public function delete(int $id): JsonResponse
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');

View File

@@ -4,7 +4,9 @@ namespace App\Controller;
use App\Services\ExpenseService;
use DateTimeImmutable;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Twig\Environment;
class PageController extends AbstractController
@@ -14,6 +16,7 @@ class PageController extends AbstractController
private ExpenseService $expenses
) {}
#[Route(path: '/', name: 'home', methods: ['GET'])]
public function daily(): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
@@ -28,4 +31,12 @@ class PageController extends AbstractController
return new Response($html);
}
#[Route('/test', name: 'test', methods: ['GET'])]
public function index(Request $request): Response
{
dump($request->attributes->get('_profiler_token')); // should not be null
exit;
// return $this->render('base.html.twig');
}
}

View File

@@ -1,10 +1,16 @@
<?php
namespace App;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Twig\Profiler\Profile;
class Kernel extends BaseKernel
{

17
templates/base.html.twig Normal file
View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Expensesasdasdasdasdasdasd App{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
{% if app.debug and app.request and app.request.attributes.get('_profiler_token') %}
{{ render(path('_wdt', { token: app.request.attributes.get('_profiler_token') })) }}
{% endif %}
</body>
</html>

View File

@@ -1,10 +1,8 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Daily Expenses</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
{% extends 'base.html.twig' %}
{% block title %}Daily Expenses{% endblock %}
{% block stylesheets %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.css">
<style>
@@ -12,9 +10,10 @@
.flatpickr-day.has-expense:hover { background: #a3cfbb !important; }
.flatpickr-day.has-expense.selected { background: #198754 !important; color: white !important; }
</style>
</head>
<body class="bg-light">
<div class="container py-4">
{% endblock %}
{% block body %}
<div class="container py-4 bg-light">
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="mb-0">Daily Expenses</h1>
<div class="d-flex gap-2">
@@ -101,13 +100,13 @@
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script src="https://code.jquery.com/jquery-3.7.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.js"></script>
<script type="text/javascript">
(function ($) {
var datesWithData = [];
@@ -248,5 +247,4 @@
});
})(jQuery);
</script>
</body>
</html>
{% endblock %}