mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
ActivityType : rename some fields
This commit is contained in:
parent
dad8fd5378
commit
cb5cf5763e
@ -43,7 +43,7 @@ class ActivityType
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private ?int $id;
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json_array")
|
||||
@ -113,12 +113,12 @@ class ActivityType
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
*/
|
||||
private int $thirdpartyVisible = self::FIELD_INVISIBLE;
|
||||
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||
*/
|
||||
private string $thirdpartyLabel = '';
|
||||
private string $thirdPartiesLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
@ -173,12 +173,12 @@ class ActivityType
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
*/
|
||||
private int $documentVisible = self::FIELD_OPTIONAL;
|
||||
private int $documentsVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||
*/
|
||||
private string $documentLabel = '';
|
||||
private string $documentsLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
@ -221,7 +221,7 @@ class ActivityType
|
||||
/**
|
||||
* Set name
|
||||
*/
|
||||
public function setName(string $name): self
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
@ -230,25 +230,10 @@ class ActivityType
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return array | string
|
||||
*/
|
||||
public function getName(?string $locale = null)
|
||||
public function getName(): array
|
||||
{
|
||||
if ($locale) {
|
||||
if (isset($this->name[$locale])) {
|
||||
return $this->name[$locale];
|
||||
} else {
|
||||
foreach ($this->name as $name) {
|
||||
if (!empty($name)) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
} else {
|
||||
return $this->name;
|
||||
}
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -390,24 +375,24 @@ class ActivityType
|
||||
$this->personsLabel = $personsLabel;
|
||||
}
|
||||
|
||||
public function getThirdpartyVisible(): int
|
||||
public function getThirdPartiesVisible(): int
|
||||
{
|
||||
return $this->thirdpartyVisible;
|
||||
return $this->thirdPartiesVisible;
|
||||
}
|
||||
|
||||
public function setThirdpartyVisible(int $thirdpartyVisible): void
|
||||
public function setThirdPartiesVisible(int $thirdPartiesVisible): void
|
||||
{
|
||||
$this->thirdpartyVisible = $thirdpartyVisible;
|
||||
$this->thirdPartiesVisible = $thirdPartiesVisible;
|
||||
}
|
||||
|
||||
public function getThirdpartyLabel(): string
|
||||
public function getThirdPartiesLabel(): string
|
||||
{
|
||||
return $this->thirdpartyLabel;
|
||||
return $this->thirdPartiesLabel;
|
||||
}
|
||||
|
||||
public function setThirdpartyLabel(string $thirdpartyLabel): void
|
||||
public function setThirdPartiesLabel(string $thirdPartiesLabel): void
|
||||
{
|
||||
$this->thirdpartyLabel = $thirdpartyLabel;
|
||||
$this->thirdPartiesLabel = $thirdPartiesLabel;
|
||||
}
|
||||
|
||||
public function getDurationTimeVisible(): int
|
||||
@ -510,24 +495,24 @@ class ActivityType
|
||||
$this->sentReceivedLabel = $sentReceivedLabel;
|
||||
}
|
||||
|
||||
public function getDocumentVisible(): int
|
||||
public function getDocumentsVisible(): int
|
||||
{
|
||||
return $this->documentVisible;
|
||||
return $this->documentsVisible;
|
||||
}
|
||||
|
||||
public function setDocumentVisible(int $documentVisible): void
|
||||
public function setDocumentsVisible(int $documentsVisible): void
|
||||
{
|
||||
$this->documentVisible = $documentVisible;
|
||||
$this->documentsVisible = $documentsVisible;
|
||||
}
|
||||
|
||||
public function getDocumentLabel(): string
|
||||
public function getDocumentsLabel(): string
|
||||
{
|
||||
return $this->documentLabel;
|
||||
return $this->documentsLabel;
|
||||
}
|
||||
|
||||
public function setDocumentLabel(string $documentLabel): void
|
||||
public function setDocumentsLabel(string $documentsLabel): void
|
||||
{
|
||||
$this->documentLabel = $documentLabel;
|
||||
$this->documentsLabel = $documentsLabel;
|
||||
}
|
||||
|
||||
public function getEmergencyVisible(): int
|
||||
|
@ -22,10 +22,6 @@ class ActivityTypeType extends AbstractType
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
@ -46,12 +42,11 @@ class ActivityTypeType extends AbstractType
|
||||
;
|
||||
|
||||
$fields = [
|
||||
'person', 'user', 'date', 'place', 'persons',
|
||||
'thirdparty', 'durationTime', 'attendee',
|
||||
'reasons', 'comment', 'sentReceived', 'document',
|
||||
'persons', 'user', 'date', 'place', 'persons',
|
||||
'thirdParties', 'durationTime', 'attendee',
|
||||
'reasons', 'comment', 'sentReceived', 'documents',
|
||||
'emergency', 'accompanyingPeriod', 'socialData'
|
||||
];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$builder
|
||||
->add($field.'Visible', ActivityFieldPresence::class)
|
||||
@ -62,9 +57,6 @@ class ActivityTypeType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Activity;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20210415113216 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE activitytype ADD thirdPartiesVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD thirdPartiesLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD documentsVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD documentsLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype DROP thirdpartyvisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP thirdpartylabel');
|
||||
$this->addSql('ALTER TABLE activitytype DROP documentvisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP documentlabel');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE activitytype ADD thirdpartyvisible SMALLINT DEFAULT 1 NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD thirdpartylabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD documentvisible SMALLINT DEFAULT 1 NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD documentlabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype DROP thirdPartiesVisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP thirdPartiesLabel');
|
||||
$this->addSql('ALTER TABLE activitytype DROP documentsVisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP documentsLabel');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user