Skip to content

Commit

Permalink
Merge branch 'release/2.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiov committed May 28, 2021
2 parents c8e8008 + 47cfb56 commit d384ce2
Show file tree
Hide file tree
Showing 34 changed files with 572 additions and 470 deletions.
37 changes: 37 additions & 0 deletions data/Migrations/Version20210522230437.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20210522230437 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() !== 'mysql',
'Migration can only be executed safely on \'mysql\'.'
);

$this->addSql('ALTER TABLE provision
CHANGE valuta date DATE NOT NULL,
CHANGE importo amount NUMERIC(8, 2) NOT NULL,
CHANGE descrizione description VARCHAR(255) NOT NULL');
}

public function down(Schema $schema): void
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() !== 'mysql',
'Migration can only be executed safely on \'mysql\'.'
);

$this->addSql('ALTER TABLE provision
CHANGE date valuta DATE NOT NULL,
CHANGE amount importo NUMERIC(8, 2) NOT NULL,
CHANGE description descrizione VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`');
}
}
37 changes: 37 additions & 0 deletions data/Migrations/Version20210523181349.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20210523181349 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() !== 'mysql',
'Migration can only be executed safely on \'mysql\'.'
);

$this->addSql('ALTER TABLE setting
CHANGE payday paypay SMALLINT UNSIGNED DEFAULT 1 NOT NULL,
CHANGE monthsretrospective months SMALLINT UNSIGNED DEFAULT 12 NOT NULL,
CHANGE stored provisioning TINYINT(1) DEFAULT 0 NOT NULL');
}

public function down(Schema $schema): void
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() !== 'mysql',
'Migration can only be executed safely on \'mysql\'.'
);

$this->addSql('ALTER TABLE setting
CHANGE paypay payDay SMALLINT UNSIGNED DEFAULT 1 NOT NULL,
CHANGE months monthsRetrospective SMALLINT UNSIGNED DEFAULT 12 NOT NULL,
CHANGE provisioning stored TINYINT(1) DEFAULT 0 NOT NULL');
}
}
9 changes: 8 additions & 1 deletion module/Application/src/Application/Entity/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ public function isClosed(): bool

public function getArrayCopy(): array
{
return get_object_vars($this);
return [
'id' => $this->id,
'user' => $this->user,
'name' => $this->name,
'recap' => $this->recap,
'closed' => $this->closed,
'movements' => $this->movements,
];
}

public function exchangeArray(array $data = []): self
Expand Down
7 changes: 6 additions & 1 deletion module/Application/src/Application/Entity/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ public function setStatus(int $status): void

public function getArrayCopy(): array
{
return get_object_vars($this);
return [
'id' => $this->id,
'user' => $this->user,
'description' => $this->description,
'status' => $this->status,
];
}

public function exchangeArray(array $data = []): void
Expand Down
9 changes: 8 additions & 1 deletion module/Application/src/Application/Entity/Movement.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ public function setDescription(string $description): void

public function getArrayCopy(): array
{
return get_object_vars($this);
return [
'id' => $this->id,
'account' => $this->amount,
'category' => $this->category,
'date' => $this->date,
'amount' => $this->amount,
'description' => $this->description,
];
}

public function exchangeArray(array $data): void
Expand Down
75 changes: 37 additions & 38 deletions module/Application/src/Application/Entity/Provision.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ class Provision implements InputFilterAwareInterface
private $user;

/**
* @ORM\Column(name="valuta", type="date", nullable=false)
* @ORM\Column(name="date", type="date", nullable=false)
* @var \DateTime
*/
private $valuta;
private $date;

/**
* @ORM\Column(name="importo", type="decimal", precision=8, scale=2, nullable=false)
* @ORM\Column(name="amount", type="decimal", precision=8, scale=2, nullable=false)
* @var float
*/
private $importo;
private $amount;

/**
* @ORM\Column(name="descrizione", type="string", nullable=false)
* @ORM\Column(name="description", type="string", nullable=false)
* @var string
*/
private $descrizione;
private $description;

public function getId(): int
{
Expand All @@ -63,64 +63,63 @@ public function setUser(User $user): void
$this->user = $user;
}

public function getValuta(): \DateTime
public function getDate(): \DateTime
{
return $this->valuta;
return $this->date;
}

public function setValuta(\DateTime $valuta): void
public function setDate(\DateTime $date): void
{
$this->valuta = $valuta;
$this->date = $date;
}

public function getImporto(): float
public function getAmount(): float
{
return $this->importo;
return $this->amount;
}

public function setImporto(float $importo): void
public function setAmount(float $amount): void
{
$this->importo = $importo;
$this->amount = $amount;
}

public function getDescrizione(): string
public function getDescription(): string
{
return $this->descrizione;
return $this->description;
}

public function setDescrizione(string $descrizione): void
public function setDescription(string $description): void
{
$this->descrizione = $descrizione;
$this->description = $description;
}

public function getArrayCopy(): array
{
return get_object_vars($this);
return [
'id' => $this->id,
'user' => $this->user,
'date' => $this->date,
'amount' => $this->amount,
'description' => $this->description,
];
}

/**
* @throws \Exception
*/
public function exchangeArray(array $data = []): void
{
if (isset($data['id'])) {
$this->id = $data['id'];
if (isset($data['user'])) {
$this->user = $data['user'];
}
if (isset($data['date'])) {
$this->date = new \DateTime($data['date']);
}
if (isset($data['userId'])) {
$this->user = $data['userId'];
if (isset($data['amount'])) {
$this->amount = $data['amount'];
}
if (isset($data['valuta'])) {
$this->valuta = new \DateTime($data['valuta']);
if (isset($data['description'])) {
$this->description = $data['description'];
}
$this->importo = $data['importo'] ?? null;
$this->descrizione = $data['descrizione'] ?? null;
}

/**
* @param \Laminas\InputFilter\InputFilterInterface $inputFilter
* @return \Laminas\InputFilter\InputFilterAwareInterface
* @throws \Exception
*/
public function setInputFilter(InputFilterInterface $inputFilter): InputFilterAwareInterface
{
throw new \Exception('Not used');
Expand All @@ -132,17 +131,17 @@ public function getInputFilter(): InputFilterInterface
$inputFilter = new InputFilter();

$inputFilter->add([
'name' => 'valuta',
'name' => 'date',
'required' => true,
'filters' => [['name' => StringTrim::class]],
]);
$inputFilter->add([
'name' => 'importo',
'name' => 'amount',
'required' => true,
'filters' => [['name' => StringTrim::class]],
]);
$inputFilter->add([
'name' => 'descrizione',
'name' => 'description',
'required' => true,
'filters' => [['name' => StringTrim::class]],
]);
Expand Down
Loading

0 comments on commit d384ce2

Please sign in to comment.