Commit 989e9560 by Julien Jorry

Fix all cascade + fix fixtures + debugs divers

parent 2b4b5cc4
App\Entity\Siege:
siege:
siege_1:
name: 'Siege MLC'
content: 'MLC'
App\Entity\Groupe:
groupe{1..10}:
name: <text(10)>
content: <text(10)>
siege: '@siege'
name: '<text(10)>'
content: '<text(200)>'
siege: '@siege_1'
App\Entity\Geoloc:
geoloc{1..70}:
adresse: <address()>
adresse: '<address()>'
# cpostal: <postcode()>
ville: <city()>
lat: <randomFloat(6, 45, 46)>
lon: <randomFloat(6, 2, 5)>
ville: '<city()>'
lat: '<randomFloat(6, 45, 46)>'
lon: '<randomFloat(6, 2, 5)>'
enabled: true
App\Entity\Comptoir:
comptoir{1..50}:
name: <text(10)>
name: '<text(10)>'
enabled: true
tel: '<phoneNumber()>'
email: <email()>
groupe: '@groupe*'
geoloc (unique): '@geoloc*'
email: '<email()>'
groupe: '@groupe<numberBetween(1,10)>'
geoloc (unique): '@geoloc<numberBetween(1,70)>'
App\Entity\Groupeprestataire:
grppresta1:
name: 'AMAP de test'
horaires: Tous les Jeudis de 12h à 14h
horaires: 'Tous les Jeudis de 12h à 14h'
grppresta2:
name: 'AMAP de test 2'
horaires: Tous les Mercredis de 12h à 14h
horaires: 'Tous les Mercredis de 12h à 14h'
grppresta3:
name: 'Marché de test'
horaires: Tous les Dimanches de 8h à 12h
horaires: 'Tous les Dimanches de 8h à 12h'
grppresta4:
name: 'Marché de test 2'
horaires: Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h
horaires: 'Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h'
App\Entity\TypePrestataire:
typepresta_prestataire:
......@@ -81,20 +81,22 @@ App\Entity\Usergroup:
App\Entity\Adherent:
adherent{1..11}:
ecompte: <randomFloat(2, 0, 50)>
ecompte: '<randomFloat(2, 0, 50)>'
# user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire:
prestataire{1..21}:
raison: <text(10)>
responsable: <text(10)>
metier: <text(10)>
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
geoloc (unique): '@geoloc*'
raison: '<text(10)>'
responsable: '<text(10)>'
metier: '<text(10)>'
iban: '<text(10)>'
statut: '<text(10)>'
siret: '<text(10)>'
geoloc (unique): '@geoloc<numberBetween(1,70)>'
# user (unique): '@user<numberBetween(11,30)>'
typeprestataire: '@typepresta_prestataire*'
typeprestataire: '@typepresta_prestataire'
prestataireGroup: '@groupe<numberBetween(1, 10)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
prestataire{22..32}:
raison: <text(10)>
responsable: <text(10)>
......@@ -102,10 +104,11 @@ App\Entity\Prestataire:
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
geoloc (unique): '@geoloc*'
geoloc (unique): '@geoloc<numberBetween(1,70)>'
# user (unique): '@user<numberBetween(11,30)>'
typeprestataire: '@typepresta_prestataire*'
groupeprestataires: ['@grppresta<numberBetween(1, 4)>']
typeprestataire: '@typepresta_prestataire'
groupeprestataires: '2x @grppresta<numberBetween(1, 4)>'
prestataireGroup: '@groupe<numberBetween(1, 4)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
App\Entity\User:
......@@ -189,14 +192,14 @@ App\Entity\User:
groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent: '@adherent<current()>'
userp{1..32}:
userp{2..32}:
username: 'p<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
# groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire (unique): '@prestataire<current()>'
prestataire: '@prestataire<current()>'
# TEST DE TRANSACTIONS / TRANSFERTS !
App\Entity\TransactionAdherentPrestataire:
......@@ -206,57 +209,57 @@ App\Entity\TransactionAdherentPrestataire:
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@adherent<current()>'
destinataire: '@prestataire*'
destinataire: '@prestataire<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestataireAdherent:
tro_pre_adh{1..10}:
tro_pre_adh{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_adherent'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@prestataire*'
expediteur: '@prestataire<current()>'
destinataire: '@adherent<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestatairePrestataire:
tro_pre_pre{1..10}:
tro_pre_pre{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_prestataire'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@prestataire*'
destinataire: '@prestataire*'
expediteur: '@prestataire<numberBetween(1, 10)>'
destinataire: '@prestataire<numberBetween(11, 21)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransfertComptoirAdherent:
tre_cpt_adh{1..10}:
tre_cpt_adh{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_adherent'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@comptoir*'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@adherent<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertComptoirGroupe:
tre_cpt_grp{1..10}:
tre_cpt_grp{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_groupe'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@comptoir*'
destinataire: '@groupe*'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@groupe<numberBetween(1,10)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertComptoirPrestataire:
tre_cpt_pre{1..10}:
tre_cpt_pre{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_prestataire'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@comptoir*'
destinataire: '@prestataire*'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@prestataire<numberBetween(1,32)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertGroupeComptoir:
......@@ -265,18 +268,18 @@ App\Entity\TransfertGroupeComptoir:
type: 'groupe_comptoir'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@groupe*'
destinataire: '@comptoir*'
expediteur: '@groupe<numberBetween(1,10)>'
destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertPrestataireComptoir:
tre_pre_cpt{1..10}:
tre_pre_cpt{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_comptoir'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@prestataire*'
destinataire: '@comptoir*'
expediteur: '@prestataire<numberBetween(1,30)>'
destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertSiegeGroupe:
......@@ -285,7 +288,7 @@ App\Entity\TransfertSiegeGroupe:
type: 'siege_groupe'
reference: 'test'
montant: '<numberBetween(1,50)>'
expediteur: '@siege'
destinataire: '@groupe*'
expediteur: '@siege_1'
destinataire: '@groupe<numberBetween(1,10)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
......@@ -41,7 +41,7 @@ class CotisationAdherentAdmin extends CotisationAdmin
{
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('user', null, array('label' => 'Utilisateur'), array('admin_code' => 'admin.adherent.gerer'))
->add('user', null, array('label' => 'Adhérent'), array('admin_code' => 'admin.adherent.gerer'))
->end()
;
parent::configureFormFields($formMapper);
......
......@@ -42,7 +42,7 @@ class CotisationAdmin extends AbstractAdmin
return MoyenEnum::getTypeName($choice);
},
))
->add('user.cotisations.first.recu', CheckboxType::class, array('label' => 'Reçu'))
->add('recu', CheckboxType::class, array('label' => 'Reçu'))
->end()
->with('Date', ['class' => 'col-md-4'])
->add('debut', null, array(
......
......@@ -37,7 +37,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('user', null, array('label' => 'Utilisateur'), array('admin_code' => 'admin.prestataire.gerer'))
->add('user', null, array('label' => 'Prestataire'), array('admin_code' => 'admin.prestataire.gerer'))
->end()
;
parent::configureFormFields($formMapper);
......
......@@ -11,14 +11,21 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Translation\TranslatorInterface;
class FluxAdmin extends AbstractAdmin
{
protected $translator;
protected $datagridValues = [
'_sort_order' => 'DESC',
'_sort_by' => 'createdAt',
];
public function setTranslator(TranslatorInterface $translator)
{
$this->translator = $translator;
}
/**
* {@inheritdoc}
*/
......@@ -70,13 +77,18 @@ class FluxAdmin extends AbstractAdmin
public function getTemplate($name)
{
if ($name == 'list') {
return 'block/fluxlist.html.twig';
return 'block/base_list_with_total.html.twig';
}
return parent::getTemplate($name);
}
public function getTotalTransaction()
public function getTotalLabel()
{
return $this->translator->trans('Total des transactions :');
}
public function getTotal()
{
$datagrid = $this->getDatagrid();
$datagrid->buildPager();
......
......@@ -4,6 +4,7 @@ namespace App\Admin;
use App\Entity\Comptoir;
use App\Entity\Siege;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
......@@ -48,6 +49,10 @@ class GroupeAdmin extends AbstractAdmin
'label' => 'Nom du groupe :',
'required' => true
))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
'required' => false,
))
->add('comptoirs', CollectionType::class, array(
'label' => 'Comptoirs',
'entry_type' => EntityType::class,
......@@ -94,6 +99,7 @@ class GroupeAdmin extends AbstractAdmin
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->add(
'getPrestatairesCount',
null,
......
......@@ -44,14 +44,14 @@ class Groupe
/**
* @var ArrayCollection|Comptoir[]
* @ORM\OneToMany(targetEntity="Comptoir", mappedBy="groupe", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\OneToMany(targetEntity="Comptoir", mappedBy="groupe", fetch="EXTRA_LAZY")
* @ORM\OrderBy({"name": "ASC"})
*/
private $comptoirs;
/**
* @var ArrayCollection|Prestataire[]
* @ORM\OneToMany(targetEntity="Prestataire", mappedBy="prestataireGroup", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\OneToMany(targetEntity="Prestataire", mappedBy="prestataireGroup", fetch="EXTRA_LAZY")
* @ORM\OrderBy({"raison": "ASC"})
*/
private $prestataires;
......
......@@ -137,13 +137,13 @@ class Prestataire
/**
* @var Groupe $prestataireGroup
*
* @ORM\ManyToOne(targetEntity="App\Entity\Groupe", cascade={"persist", "remove"}, inversedBy="prestataires")
* @ORM\ManyToOne(targetEntity="App\Entity\Groupe", inversedBy="prestataires")
*/
private $prestataireGroup;
/**
* @var ArrayCollection|Amap[]
* @ORM\ManyToMany(targetEntity="Groupeprestataire", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
* @var ArrayCollection|Amap/Marché[]
* @ORM\ManyToMany(targetEntity="Groupeprestataire", mappedBy="prestataires", fetch="EXTRA_LAZY")
* @ORM\JoinTable(name="groupes_prestataires")
*/
private $groupeprestataires;
......
......@@ -29,7 +29,7 @@ class Siege
/**
* @var ArrayCollection|Groupe[]
* @ORM\OneToMany(targetEntity="Groupe", mappedBy="siege", cascade={"persist"})
* @ORM\OneToMany(targetEntity="Groupe", mappedBy="siege")
*/
private $groupes;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransactionAdherentPrestataire extends Transaction
{
/**
* @ORM\OneToOne(targetEntity="Adherent", cascade={"all"})
* @ORM\OneToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Prestataire", cascade={"all"})
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransactionPrestataireAdherent extends Transaction
{
/**
* @ORM\OneToOne(targetEntity="Prestataire", cascade={"all"})
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Adherent", cascade={"all"})
* @ORM\OneToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransactionPrestatairePrestataire extends Transaction
{
/**
* @ORM\OneToOne(targetEntity="Prestataire", cascade={"all"})
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Prestataire", cascade={"all"})
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_dest_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransfertComptoirAdherent extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Comptoir", cascade={"all"})
* @ORM\OneToOne(targetEntity="Comptoir")
* @ORM\JoinColumn(name="comptoir_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Adherent", cascade={"all"})
* @ORM\OneToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransfertComptoirGroupe extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Comptoir", cascade={"all"})
* @ORM\OneToOne(targetEntity="Comptoir")
* @ORM\JoinColumn(name="comptoir_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Groupe", cascade={"all"})
* @ORM\OneToOne(targetEntity="Groupe")
* @ORM\JoinColumn(name="groupe_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransfertComptoirPrestataire extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Comptoir", cascade={"all"})
* @ORM\OneToOne(targetEntity="Comptoir")
* @ORM\JoinColumn(name="comptoir_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Prestataire", cascade={"all"})
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransfertGroupeComptoir extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Groupe", cascade={"all"})
* @ORM\OneToOne(targetEntity="Groupe")
* @ORM\JoinColumn(name="groupe_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Comptoir", cascade={"all"})
* @ORM\OneToOne(targetEntity="Comptoir")
* @ORM\JoinColumn(name="comptoir_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransfertPrestataireComptoir extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Prestataire", cascade={"all"})
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Comptoir", cascade={"all"})
* @ORM\OneToOne(targetEntity="Comptoir")
* @ORM\JoinColumn(name="comptoir_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -16,13 +16,13 @@ use Doctrine\ORM\Mapping as ORM;
class TransfertSiegeGroupe extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Siege", cascade={"all"})
* @ORM\OneToOne(targetEntity="Siege")
* @ORM\JoinColumn(name="siege_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Groupe", cascade={"all"})
* @ORM\OneToOne(targetEntity="Groupe")
* @ORM\JoinColumn(name="groupe_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......
......@@ -59,12 +59,12 @@ class User extends BaseUser
/**
* @var ArrayCollection|Cotisation[]
*
* @ORM\OneToMany(targetEntity="Cotisation", mappedBy="user", cascade={"all"}, orphanRemoval=true)
* @ORM\OneToMany(targetEntity="Cotisation", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $cotisations;
/**
* @ORM\OneToMany(targetEntity="Flux", mappedBy="operateur", cascade={"all"})
* @ORM\OneToMany(targetEntity="Flux", mappedBy="operateur")
*/
protected $flux;
......
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190124180511 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE cotisation CHANGE moyen moyen VARCHAR(100) NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE cotisation CHANGE moyen moyen VARCHAR(20) NOT NULL COLLATE utf8mb4_unicode_ci');
}
}
{% extends '@SonataAdmin/CRUD/base_list.html.twig' %}
{% block list_header %}
<div class="pull-left" style="margin: 10px 5px;">
<label for="{{ admin.uniqid }}_sum_of_orders" class="control-label">Total des transactions : </label>
<label class="control-label">{{ admin.getTotalTransaction() }}</label>
</div>
{% if admin.total is defined %}
<div class="pull-left" style="margin: 10px 5px;">
<label for="{{ admin.uniqid }}_sum_of_orders" class="control-label">{{ admin.totalLabel is defined ? admin.totalLabel : 'Total : '}}</label>
<label class="control-label">{{ admin.total }}</label>
</div>
{% endif %}
{% endblock %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment