mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
import changes on address from chill main
This commit is contained in:
parent
490ea5bd72
commit
a2f6773f5a
@ -146,3 +146,13 @@ Version 1.5.21
|
|||||||
- [CRUD] Forward query parameters when pushing button "save and new" in "create" page;
|
- [CRUD] Forward query parameters when pushing button "save and new" in "create" page;
|
||||||
- [Show/hide] Take selects input into account;
|
- [Show/hide] Take selects input into account;
|
||||||
|
|
||||||
|
Version 1.5.23
|
||||||
|
==============
|
||||||
|
|
||||||
|
- [address] allow to add custom fields to addresses
|
||||||
|
|
||||||
|
Version 1.5.24
|
||||||
|
==============
|
||||||
|
|
||||||
|
- [bugfix] add missing migration files
|
||||||
|
|
||||||
|
@ -58,19 +58,22 @@ class Address
|
|||||||
* True if the address is a "no address", aka homeless person, ...
|
* True if the address is a "no address", aka homeless person, ...
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
* @ORM\Column(type="boolean")
|
|
||||||
*/
|
*/
|
||||||
private $isNoAddress = false;
|
private $isNoAddress = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address constructor.
|
* A list of metadata, added by customizable fields
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
private $customs = [];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->validFrom = new \DateTime();
|
$this->validFrom = new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
@ -205,6 +208,29 @@ class Address
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get customs informations in the address
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCustoms(): array
|
||||||
|
{
|
||||||
|
return $this->customs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store custom informations in the address
|
||||||
|
*
|
||||||
|
* @param array $customs
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setCustoms(array $customs): self
|
||||||
|
{
|
||||||
|
$this->customs = $customs;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the address.
|
* Validate the address.
|
||||||
*
|
*
|
||||||
|
@ -187,3 +187,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block address_widget %}
|
||||||
|
{% for entry in form %}
|
||||||
|
{% if entry.vars.name != 'customs' %}
|
||||||
|
{{ form_row(entry) }}
|
||||||
|
{% else %}
|
||||||
|
{{ form_widget(entry) }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
32
src/Bundle/ChillMain/migrations/Version20210308111926.php
Normal file
32
src/Bundle/ChillMain/migrations/Version20210308111926.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Application\Migrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add custom data in address
|
||||||
|
*/
|
||||||
|
final class Version20210308111926 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address ADD customs JSONB DEFAULT \'[]\'');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address DROP customs');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return "Add custom data in addresses";
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user