Skip to content

Commit

Permalink
Added fields CommissionableAsset.{licensePlate, comments}
Browse files Browse the repository at this point in the history
  • Loading branch information
nikophil committed Apr 15, 2020
1 parent 6426959 commit 9b3df59
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Entity/CommissionableAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ class CommissionableAsset implements AvailabilitableInterface
*/
public int $seatingCapacity = 1;

/**
* @ORM\Column(type="string", nullable=true)
*/
public ?string $licensePlate = null;

/**
* @ORM\Column(type="text", nullable=true)
*/
public ?string $comments = null;

public function __toString(): string
{
return $this->type.' - '.$this->name;
Expand Down
7 changes: 7 additions & 0 deletions src/Form/Type/CommissionableAssetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
Expand Down Expand Up @@ -66,6 +67,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->add('seatingCapacity', IntegerType::class, [
'label' => 'Combien de places ?',
])
->add('licensePlate', TextType::class, [
'label' => 'Plaque d\'immatriculation',
])
->add('comments', TextareaType::class, [
'label' => 'Commentaires',
])
->add('submit', SubmitType::class)
;

Expand Down
35 changes: 35 additions & 0 deletions src/Migrations/Version20200414132415.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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 Version20200414132415 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() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('ALTER TABLE commissionable_asset ADD license_plate VARCHAR(255) DEFAULT NULL, ADD comments TEXT DEFAULT 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() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('ALTER TABLE commissionable_asset DROP license_plate, DROP comments');
}
}

0 comments on commit 9b3df59

Please sign in to comment.