first commit

This commit is contained in:
afornerot 2024-11-18 17:07:22 +01:00
parent 416ce7479f
commit d8882c93b9
26 changed files with 1150 additions and 104 deletions

41
.env
View File

@ -1,41 +1,6 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_ENV=dev APP_ENV=dev
APP_SECRET=54728c0e8abdcd79758807c0abea30ea APP_SECRET=changeme
###< symfony/framework-bundle ### DATABASE_URL="mysql://user:changeme@mariadb:3306/ninecompta"
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###
###> symfony/mailer ### APP_NAME=Ninecompta
# MAILER_DSN=null://null
###< symfony/mailer ###

View File

@ -1,10 +1,14 @@
import './bootstrap.js'; import './bootstrap.js';
/*
* Welcome to your app's main JavaScript file! // jQuery
* import $ from 'jquery';
* This file will be included onto the page via the importmap() Twig function, window.$ = $;
* which should already be in your base.html.twig.
*/ // Bootstrap
import 'bootstrap/dist/css/bootstrap.min.css';
// Local CSS
import './styles/bootswatch.min.css'
import './styles/app.css'; import './styles/app.css';
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉'); console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');

View File

@ -1,3 +1,5 @@
body {
background-color: skyblue; .navbar-brand img {
} width:40px;
margin-right:10px;
}

12
assets/styles/bootswatch.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,18 +0,0 @@
services:
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
###> symfony/mailer ###
mailer:
image: axllent/mailpit
ports:
- "1025"
- "8025"
environment:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
###< symfony/mailer ###

View File

@ -1,25 +1,41 @@
version: '3'
services: services:
###> doctrine/doctrine-bundle ### mariadb:
database: image: mariadb
image: postgres:${POSTGRES_VERSION:-16}-alpine container_name: ninecompta-mariadb
restart: unless-stopped
environment: environment:
POSTGRES_DB: ${POSTGRES_DB:-app} MYSQL_ROOT_PASSWORD: changeme
# You should definitely change the password in production MYSQL_DATABASE: ninecompta
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!} MYSQL_USER: user
POSTGRES_USER: ${POSTGRES_USER:-app} MYSQL_PASSWORD: changeme
healthcheck:
test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
timeout: 5s
retries: 5
start_period: 60s
volumes: volumes:
- database_data:/var/lib/postgresql/data:rw - mariadb-data:/var/lib/mysql
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw ninecompta:
###< doctrine/doctrine-bundle ### build:
context: .
dockerfile: ./misc/docker/Dockerfile
container_name: ninecompta-app
restart: unless-stopped
image: reg.cadoles.com/envole/ninecompta
depends_on:
- mariadb
env_file: .env
ports:
- "8008:80"
volumes:
- .:/app:delegated
adminer:
image: adminer
container_name: ninecompta-adminer
restart: always
ports:
- 6088:8080
volumes: volumes:
###> doctrine/doctrine-bundle ### mariadb-data:
database_data:
###< doctrine/doctrine-bundle ###

View File

@ -4,14 +4,18 @@ security:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers: providers:
users_in_memory: { memory: null } # used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: username
firewalls: firewalls:
dev: dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/ pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false security: false
main: main:
lazy: true lazy: true
provider: users_in_memory provider: app_user_provider
# activate different ways to authenticate # activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall # https://symfony.com/doc/current/security.html#the-firewall

View File

@ -1,6 +1,9 @@
twig: twig:
file_name_pattern: '*.twig' file_name_pattern: "*.twig"
globals:
appName: "%appName%"
when@test: when@test:
twig: twig:
strict_variables: true strict_variables: true

View File

@ -4,21 +4,24 @@
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters: parameters:
appEnv: "%env(resolve:APP_ENV)%"
appSecret: "%env(resolve:APP_SECRET)%"
appName: "%env(resolve:APP_NAME)%"
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file
_defaults: _defaults:
autowire: true # Automatically injects dependencies in your services. autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services # makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name # this creates a service per class whose id is the fully-qualified class name
App\: App\:
resource: '../src/' resource: "../src/"
exclude: exclude:
- '../src/DependencyInjection/' - "../src/DependencyInjection/"
- '../src/Entity/' - "../src/Entity/"
- '../src/Kernel.php' - "../src/Kernel.php"
# add more service definitions when explicit configuration is needed # add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones # please note that last definitions always *replace* previous ones

View File

@ -25,4 +25,11 @@ return [
'@hotwired/turbo' => [ '@hotwired/turbo' => [
'version' => '7.3.0', 'version' => '7.3.0',
], ],
'jquery' => [
'version' => '3.7.1',
],
'bootstrap/dist/css/bootstrap.min.css' => [
'version' => '5.3.3',
'type' => 'css',
],
]; ];

21
misc/docker/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM reg.cadoles.com/envole/nineapache:8.2
COPY ./misc/docker/apache.conf /etc/apache2/conf.d/nine/site.conf
RUN echo "* * * * * /app/bin/console app:Cron --env=prod" >> /var/spool/cron/crontabs/root
WORKDIR /app
COPY . .
# Installation des dépendances composer
RUN composer install --no-interaction
RUN mkdir -p /app/public/uploads
RUN chown apache /app/public/uploads -R
RUN chmod u+w /app/public/uploads -R
RUN mkdir -p /app/var
RUN chown apache /app/var -R
RUN chmod u+w /app/var -R
CMD /app/misc/script/reconfigure.sh && /etc/apache2/apache2.sh

19
misc/docker/apache.conf Executable file
View File

@ -0,0 +1,19 @@
LoadModule rewrite_module modules/mod_rewrite.so
ServerName nineapache.local
DocumentRoot "/app/public"
Alias /ninefolio /app/public
<Directory "/app/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</Directory>

12
misc/script/reconfigure.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -eo pipefail
# Se positionner sur la racine du projet
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ${DIR}
cd ../..
DIR=$(pwd)
bin/console d:s:u --force --complete
exec $@

BIN
public/medias/logo/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,49 @@
<?php
namespace App\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:init',
description: 'Add a short description for your command',
)]
class InitCommand extends Command
{
public function __construct()
{
parent::__construct();
}
protected function configure(): void
{
$this
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$arg1 = $input->getArgument('arg1');
if ($arg1) {
$io->note(sprintf('You passed an argument: %s', $arg1));
}
if ($input->getOption('option1')) {
// ...
}
$io->success('You have a new command! Now make it your own! Pass --help to see your options.');
return Command::SUCCESS;
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class HomeController extends AbstractController
{
#[Route('/', name: 'app_home')]
public function index(): Response
{
return $this->render('home/index.html.twig', [
'controller_name' => 'HomeController',
]);
}
}

176
src/Entity/Accounting.php Normal file
View File

@ -0,0 +1,176 @@
<?php
namespace App\Entity;
use App\Repository\AccountingRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AccountingRepository::class)]
class Accounting
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $num01 = null;
#[ORM\Column(length: 255)]
private ?string $num02 = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column]
private ?bool $actif = null;
#[ORM\ManyToOne(inversedBy: 'accountings')]
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
/**
* @var Collection<int, Operation>
*/
#[ORM\OneToMany(targetEntity: Operation::class, mappedBy: 'credit', orphanRemoval: true)]
private Collection $credits;
/**
* @var Collection<int, Operation>
*/
#[ORM\OneToMany(targetEntity: Operation::class, mappedBy: 'debit', orphanRemoval: true)]
private Collection $debits;
public function __construct()
{
$this->credits = new ArrayCollection();
$this->debits = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNum01(): ?string
{
return $this->num01;
}
public function setNum01(string $num01): static
{
$this->num01 = $num01;
return $this;
}
public function getNum02(): ?string
{
return $this->num02;
}
public function setNum02(string $num02): static
{
$this->num02 = $num02;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function isActif(): ?bool
{
return $this->actif;
}
public function setActif(bool $actif): static
{
$this->actif = $actif;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): static
{
$this->company = $company;
return $this;
}
/**
* @return Collection<int, Operation>
*/
public function getCredits(): Collection
{
return $this->credits;
}
public function addCredit(Operation $credit): static
{
if (!$this->credits->contains($credit)) {
$this->credits->add($credit);
$credit->setCredit($this);
}
return $this;
}
public function removeCredit(Operation $credit): static
{
if ($this->credits->removeElement($credit)) {
// set the owning side to null (unless already changed)
if ($credit->getCredit() === $this) {
$credit->setCredit(null);
}
}
return $this;
}
/**
* @return Collection<int, Operation>
*/
public function getDebits(): Collection
{
return $this->debits;
}
public function addDebit(Operation $debit): static
{
if (!$this->debits->contains($debit)) {
$this->debits->add($debit);
$debit->setDebit($this);
}
return $this;
}
public function removeDebit(Operation $debit): static
{
if ($this->debits->removeElement($debit)) {
// set the owning side to null (unless already changed)
if ($debit->getDebit() === $this) {
$debit->setDebit(null);
}
}
return $this;
}
}

263
src/Entity/Company.php Normal file
View File

@ -0,0 +1,263 @@
<?php
namespace App\Entity;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
class Company
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $adress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logo = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankname = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankcode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankguichet = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $banknum = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankkey = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $banklocality = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankiban = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bankbic = null;
/**
* @var Collection<int, Accounting>
*/
#[ORM\OneToMany(targetEntity: Accounting::class, mappedBy: 'company', orphanRemoval: true)]
private Collection $accountings;
/**
* @var Collection<int, User>
*/
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'companys')]
private Collection $users;
public function __construct()
{
$this->accountings = new ArrayCollection();
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getAdress(): ?string
{
return $this->adress;
}
public function setAdress(string $adress): static
{
$this->adress = $adress;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): static
{
$this->logo = $logo;
return $this;
}
public function getBankname(): ?string
{
return $this->bankname;
}
public function setBankname(?string $bankname): static
{
$this->bankname = $bankname;
return $this;
}
public function getBankcode(): ?string
{
return $this->bankcode;
}
public function setBankcode(?string $bankcode): static
{
$this->bankcode = $bankcode;
return $this;
}
public function getBankguichet(): ?string
{
return $this->bankguichet;
}
public function setBankguichet(?string $bankguichet): static
{
$this->bankguichet = $bankguichet;
return $this;
}
public function getBanknum(): ?string
{
return $this->banknum;
}
public function setBanknum(?string $banknum): static
{
$this->banknum = $banknum;
return $this;
}
public function getBankkey(): ?string
{
return $this->bankkey;
}
public function setBankkey(?string $bankkey): static
{
$this->bankkey = $bankkey;
return $this;
}
public function getBanklocality(): ?string
{
return $this->banklocality;
}
public function setBanklocality(?string $banklocality): static
{
$this->banklocality = $banklocality;
return $this;
}
public function getBankiban(): ?string
{
return $this->bankiban;
}
public function setBankiban(?string $bankiban): static
{
$this->bankiban = $bankiban;
return $this;
}
public function getBankbic(): ?string
{
return $this->bankbic;
}
public function setBankbic(?string $bankbic): static
{
$this->bankbic = $bankbic;
return $this;
}
/**
* @return Collection<int, Accounting>
*/
public function getAccountings(): Collection
{
return $this->accountings;
}
public function addAccounting(Accounting $accounting): static
{
if (!$this->accountings->contains($accounting)) {
$this->accountings->add($accounting);
$accounting->setCompany($this);
}
return $this;
}
public function removeAccounting(Accounting $accounting): static
{
if ($this->accountings->removeElement($accounting)) {
// set the owning side to null (unless already changed)
if ($accounting->getCompany() === $this) {
$accounting->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): static
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->addCompany($this);
}
return $this;
}
public function removeUser(User $user): static
{
if ($this->users->removeElement($user)) {
$user->removeCompany($this);
}
return $this;
}
}

98
src/Entity/Operation.php Normal file
View File

@ -0,0 +1,98 @@
<?php
namespace App\Entity;
use App\Repository\OperationRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OperationRepository::class)]
class Operation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $date = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
private ?string $montant = null;
#[ORM\ManyToOne(inversedBy: 'credits')]
#[ORM\JoinColumn(nullable: false)]
private ?Accounting $credit = null;
#[ORM\ManyToOne(inversedBy: 'debits')]
#[ORM\JoinColumn(nullable: false)]
private ?Accounting $debit = null;
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): static
{
$this->date = $date;
return $this;
}
public function getMontant(): ?string
{
return $this->montant;
}
public function setMontant(string $montant): static
{
$this->montant = $montant;
return $this;
}
public function getCredit(): ?Accounting
{
return $this->credit;
}
public function setCredit(?Accounting $credit): static
{
$this->credit = $credit;
return $this;
}
public function getDebit(): ?Accounting
{
return $this->debit;
}
public function setDebit(?Accounting $debit): static
{
$this->debit = $debit;
return $this;
}
}

145
src/Entity/User.php Normal file
View File

@ -0,0 +1,145 @@
<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 180)]
private ?string $username = null;
/**
* @var list<string> The user roles
*/
#[ORM\Column]
private array $roles = [];
/**
* @var string The hashed password
*/
#[ORM\Column]
private ?string $password = null;
/**
* @var Collection<int, Company>
*/
#[ORM\ManyToMany(targetEntity: Company::class, inversedBy: 'users')]
private Collection $companys;
public function __construct()
{
$this->companys = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUsername(): ?string
{
return $this->username;
}
public function setUsername(string $username): static
{
$this->username = $username;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->username;
}
/**
* @see UserInterface
*
* @return list<string>
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
/**
* @param list<string> $roles
*/
public function setRoles(array $roles): static
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials(): void
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
/**
* @return Collection<int, Company>
*/
public function getCompanys(): Collection
{
return $this->companys;
}
public function addCompany(Company $company): static
{
if (!$this->companys->contains($company)) {
$this->companys->add($company);
}
return $this;
}
public function removeCompany(Company $company): static
{
$this->companys->removeElement($company);
return $this;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Accounting;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Accounting>
*/
class AccountingRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Accounting::class);
}
// /**
// * @return Accounting[] Returns an array of Accounting objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('a.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Accounting
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Company;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Company>
*/
class CompanyRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Company::class);
}
// /**
// * @return Company[] Returns an array of Company objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Company
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Operation;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Operation>
*/
class OperationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Operation::class);
}
// /**
// * @return Operation[] Returns an array of Operation objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('o.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Operation
// {
// return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Repository;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
* @extends ServiceEntityRepository<User>
*/
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, User::class);
}
/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{
if (!$user instanceof User) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
}
$user->setPassword($newHashedPassword);
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}
// /**
// * @return User[] Returns an array of User objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('u.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?User
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -12,6 +12,44 @@
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
{% block body %}{% endblock %} <nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="#"><img src="{{asset("medias/logo/logo.png")}}"> {{appName}}</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarColor02">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link active" href="#">Home
<span class="visually-hidden">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
{% block body %}
{% endblock %}
</body> </body>
</html> </html>

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello HomeController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code>/home/afornerot/cadoles/nine-project/ninecompta/src/Controller/HomeController.php</code></li>
<li>Your template at <code>/home/afornerot/cadoles/nine-project/ninecompta/templates/home/index.html.twig</code></li>
</ul>
</div>
{% endblock %}