Merge branch 'features/activity-model' into features/activity-form

This commit is contained in:
Jean-Francois Monfort
2021-04-22 16:26:59 +02:00
41 changed files with 1060 additions and 561 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace Chill\ActivityBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class AdminActivityPresenceController extends CRUDController
{
/**
* @param string $action
* @param \Doctrine\ORM\QueryBuilder|mixed $query
* @param Request $request
* @param PaginatorInterface $paginator
* @return \Doctrine\ORM\QueryBuilder|mixed
*/
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
/** @var \Doctrine\ORM\QueryBuilder $query */
return $query->orderBy('e.id', 'ASC');
}
}

View File

@@ -137,7 +137,28 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
'template' => '@ChillActivity/ActivityTypeCategory/edit.html.twig',
]
]
]
],
[
'class' => \Chill\ActivityBundle\Entity\ActivityPresence::class,
'name' => 'activity_presence',
'base_path' => '/admin/activity/presence',
'form_class' => \Chill\ActivityBundle\Form\ActivityPresenceType::class,
'controller' => \Chill\ActivityBundle\Controller\AdminActivityPresenceController::class,
'actions' => [
'index' => [
'template' => '@ChillActivity/ActivityPresence/index.html.twig',
'role' => 'ROLE_ADMIN'
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityPresence/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillActivity/ActivityPresence/edit.html.twig',
]
]
],
]
]);
}

View File

@@ -20,13 +20,13 @@
namespace Chill\ActivityBundle\Entity;
use Chill\DocStoreBundle\Entity\Document;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\Center;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
@@ -48,94 +48,118 @@ use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
*/
class Activity implements HasCenterInterface, HasScopeInterface
{
const SENTRECEIVED_SENT = 'sent';
const SENTRECEIVED_RECEIVED = 'received';
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
private ?int $id;
/**
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private $user;
private User $user;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
*/
private $date;
private \DateTime $date;
/**
* @var \DateTime
* @ORM\Column(type="time")
*/
private $durationTime;
private \DateTime $durationTime;
/**
* @var boolean
* @ORM\Column(type="boolean")
* @ORM\Column(type="time", nullable=true)
*/
private $attendee;
private ?\DateTime $travelTime;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*/
private ActivityPresence $attendee;
/**
* @var ActivityReason
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
*/
private $reasons;
private Collection $reasons;
/**
* @var ActivityType
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
*/
private $type;
private ActivityType $type;
/**
* @var Scope
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private $scope;
private Scope $scope;
/**
* @var Person
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private $person;
private Person $person;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
private $comment;
private CommentEmbeddable $comment;
/**
* Activity constructor.
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private Collection $persons;
/**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
*/
private Collection $thirdParties;
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\Document")
*/
private Collection $documents;
/**
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
*/
private Collection $users;
/**
* @ORM\Column(type="boolean", options={"default"=false})
*/
private bool $emergency = false;
/**
* @ORM\Column(type="string", options={"default"=""})
*/
private string $sentReceived = '';
public function __construct()
{
$this->reasons = new ArrayCollection();
$this->comment = new CommentEmbeddable();
$this->persons = new ArrayCollection();
$this->thirdParties = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->users = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
public function getId(): int
{
return $this->id;
}
/**
* Set user
*
* @param User $user
* @return Activity
*/
public function setUser(User $user)
public function setUser(User $user): self
{
$this->user = $user;
@@ -144,21 +168,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get user
*
* @return User
*/
public function getUser()
public function getUser(): User
{
return $this->user;
}
/**
* Set date
*
* @param \DateTime $date
* @return Activity
*/
public function setDate($date)
public function setDate(\DateTime $date): self
{
$this->date = $date;
@@ -167,21 +186,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get date
*
* @return \DateTime
*/
public function getDate()
public function getDate(): \DateTime
{
return $this->date;
}
/**
* Set durationTime
*
* @param \DateTime $durationTime
* @return Activity
*/
public function setDurationTime($durationTime)
public function setDurationTime(\DateTime $durationTime): self
{
$this->durationTime = $durationTime;
@@ -190,75 +204,63 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get durationTime
*
* @return \DateTime
*/
public function getDurationTime()
public function getDurationTime(): \DateTime
{
return $this->durationTime;
}
/**
* Set attendee
*
* @param boolean $attendee
* @return Activity
*/
public function setAttendee($attendee)
public function setTravelTime(\DateTime $travelTime): self
{
$this->travelTime = $travelTime;
return $this;
}
public function getTravelTime(): \DateTime
{
return $this->travelTime;
}
public function setAttendee(ActivityPresence $attendee): self
{
$this->attendee = $attendee;
return $this;
}
/**
* Get attendee
*
* @return boolean
*/
public function getAttendee()
public function getAttendee(): ActivityPresence
{
return $this->attendee;
}
/**
* Add a reason
*
* @param ActivityReason $reason
* @return Activity
*/
public function addReason(ActivityReason $reason)
public function addReason(ActivityReason $reason): self
{
$this->reasons[] = $reason;
return $this;
}
/**
* @param ActivityReason $reason
*/
public function removeReason(ActivityReason $reason)
public function removeReason(ActivityReason $reason): void
{
$this->reasons->removeElement($reason);
}
/**
* Get reasons
*
* @return Collection
*/
public function getReasons()
public function getReasons(): Collection
{
return $this->reasons;
}
/**
* Set type
*
* @param ActivityType $type
* @return Activity
*/
public function setType(ActivityType $type)
public function setType(ActivityType $type): self
{
$this->type = $type;
@@ -267,21 +269,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get type
*
* @return ActivityType
*/
public function getType()
public function getType(): ActivityType
{
return $this->type;
}
/**
* Set scope
*
* @param Scope $scope
* @return Activity
*/
public function setScope(Scope $scope)
public function setScope(Scope $scope): self
{
$this->scope = $scope;
@@ -290,21 +287,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get scope
*
* @return Scope
*/
public function getScope()
public function getScope(): Scope
{
return $this->scope;
}
/**
* Set person
*
* @param Person $person
* @return Activity
*/
public function setPerson(Person $person)
public function setPerson(Person $person): self
{
$this->person = $person;
@@ -313,10 +305,8 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get person
*
* @return Person
*/
public function getPerson()
public function getPerson(): Person
{
return $this->person;
}
@@ -324,28 +314,150 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* get the center
* center is extracted from person
*
* @return Center
*/
public function getCenter()
public function getCenter(): Center
{
return $this->person->getCenter();
}
/**
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
*/
public function getComment()
public function getComment(): CommentEmbeddable
{
return $this->comment;
}
/**
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
*/
public function setComment($comment)
public function setComment(CommentEmbeddable $comment): self
{
$this->comment = $comment;
return $this;
}
/**
* Add a person to the person list
*/
public function addPerson(Person $person): self
{
$this->persons[] = $person;
return $this;
}
public function removePerson(Person $person): void
{
$this->persons->removeElement($person);
}
public function getPersons(): Collection
{
return $this->persons;
}
public function setPersons(Collection $persons): self
{
$this->persons = $persons;
return $this;
}
public function addThirdParty(ThirdParty $thirdParty): self
{
$this->thirdParties[] = $thirdParty;
return $this;
}
public function removeThirdParty(ThirdParty $thirdParty): void
{
$this->thirdParties->removeElement($thirdParty);
}
public function getThirdParties(): Collection
{
return $this->thirdParties;
}
public function setThirdParties(Collection $thirdParties): self
{
$this->thirdParties = $thirdParties;
return $this;
}
public function addDocument(Document $document): self
{
$this->documents[] = $document;
return $this;
}
public function removeDocument(Document $document): void
{
$this->documents->removeElement($document);
}
public function getDocuments(): Collection
{
return $this->documents;
}
public function setDocuments(Collection $documents): self
{
$this->documents = $documents;
return $this;
}
public function addUser(User $user): self
{
$this->users[] = $user;
return $this;
}
public function removeUser(User $user): void
{
$this->users->removeElement($user);
}
public function getUsers(): Collection
{
return $this->users;
}
public function setUsers(Collection $users): self
{
$this->users = $users;
return $this;
}
public function isEmergency(): bool
{
return $this->getEmergency();
}
public function getEmergency(): bool
{
return $this->emergency;
}
public function setEmergency(bool $emergency): self
{
$this->emergency = $emergency;
return $this;
}
public function getSentReceived(): string
{
return $this->sentReceived;
}
public function setSentReceived(string $sentReceived): self
{
$this->sentReceived = $sentReceived;
return $this;
}
}

View File

@@ -0,0 +1,97 @@
<?php
/*
*
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityPresence
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Table(name="activitytpresence")
* @ORM\HasLifecycleCallbacks()
*/
class ActivityPresence
{
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id;
/**
* @ORM\Column(type="json")
*/
private array $name = [];
/**
* @ORM\Column(type="boolean")
*/
private bool $active = true;
public function getId(): int
{
return $this->id;
}
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
public function getName(): array
{
return $this->name;
}
/**
* Get active
* return true if the category type is active.
*/
public function getActive(): bool
{
return $this->active;
}
/**
* Is active
* return true if the category type is active
*/
public function isActive(): bool
{
return $this->getActive();
}
/**
* Set active
* set to true if the category type is active
*/
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
}

View File

@@ -37,8 +37,6 @@ class ActivityType
const FIELD_REQUIRED = 2;
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
@@ -130,6 +128,16 @@ class ActivityType
*/
private string $durationTimeLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
private int $travelTimeVisible = self::FIELD_OPTIONAL;
/**
* @ORM\Column(type="string", nullable=false, options={"default"=""})
*/
private string $travelTimeLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
@@ -180,6 +188,16 @@ class ActivityType
*/
private string $documentsLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
private int $usersVisible = self::FIELD_OPTIONAL;
/**
* @ORM\Column(type="string", nullable=false, options={"default"=""})
*/
private string $usersLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
@@ -415,6 +433,26 @@ class ActivityType
$this->durationTimeLabel = $durationTimeLabel;
}
public function getTravelTimeVisible(): int
{
return $this->travelTimeVisible;
}
public function setTravelTimeVisible(int $TravelTimeVisible): void
{
$this->travelTimeVisible = $TravelTimeVisible;
}
public function getTravelTimeLabel(): string
{
return $this->travelTimeLabel;
}
public function setTravelTimeLabel(string $TravelTimeLabel): void
{
$this->travelTimeLabel = $TravelTimeLabel;
}
public function getAttendeeVisible(): int
{
return $this->attendeeVisible;
@@ -515,6 +553,26 @@ class ActivityType
$this->documentsLabel = $documentsLabel;
}
public function getUsersVisible(): int
{
return $this->usersVisible;
}
public function setUsersVisible(int $usersVisible): void
{
$this->usersVisible = $usersVisible;
}
public function getUsersLabel(): string
{
return $this->usersLabel;
}
public function setUsersLabel(string $usersLabel): void
{
$this->usersLabel = $usersLabel;
}
public function getEmergencyVisible(): int
{
return $this->emergencyVisible;

View File

@@ -69,8 +69,6 @@ class ActivityTypeCategory
/**
* Get name
*
* @return array | string
*/
public function getName(): array
{

View File

@@ -0,0 +1,33 @@
<?php
namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Entity\ActivityPresence;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
class ActivityPresenceType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TranslatableStringFormType::class)
->add('active', ChoiceType::class, array(
'choices' => array(
'Yes' => true,
'No' => false
),
'expanded' => true
));
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(array(
'data_class' => ActivityPresence::class
));
}
}

View File

@@ -43,9 +43,9 @@ class ActivityTypeType extends AbstractType
$fields = [
'persons', 'user', 'date', 'place', 'persons',
'thirdParties', 'durationTime', 'attendee',
'thirdParties', 'durationTime', 'travelTime', 'attendee',
'reasons', 'comment', 'sentReceived', 'documents',
'emergency', 'accompanyingPeriod', 'socialData'
'emergency', 'accompanyingPeriod', 'socialData', 'users'
];
foreach ($fields as $field) {
$builder

View File

@@ -0,0 +1,12 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,44 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h1>{{ 'ActivityPresence list'|trans }}</h1>
<table class="records_list">
<thead>
<tr>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td>{{ entity.name|localize_translatable_string }}</td>
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('chill_crud_activity_presence_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('chill_crud_activity_presence_new') }}" class="sc-button bt-create">
{{ 'Create a new activity presence'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -46,3 +46,12 @@ chill_activity_type_category_admin:
admin_activity:
order: 2999
label: 'Activity Types Categories'
chill_activity_presence_admin:
path: /{_locale}/admin/activity/presence
controller: cscrud_activity_presence_controller:index
options:
menus:
admin_activity:
order: 2021
label: 'Activity Presences'

View File

@@ -0,0 +1,52 @@
<?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 Version20210422073711 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql('CREATE SEQUENCE activitytpresence_id_seq INCREMENT BY 1 MINVALUE 1 START 6');
$this->addSql('CREATE TABLE activitytpresence (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$list = [
'Usager pésent', "Absence de l''usager",
"Refus de visite ou d''entretien", 'Domicile non trouvé',
'Domicile erronéee'
];
for ($i = 1; $i <= count($list); $i++) {
$this->addSql("INSERT INTO activitytpresence VALUES(".$i.", json_build_object('fr', '".$list[$i-1]."'), true)");
}
$this->addSql('ALTER TABLE activity ADD emergency BOOLEAN NOT NULL DEFAULT false');
$this->addSql('ALTER TABLE activity ADD sentReceived VARCHAR(255) NOT NULL DEFAULT \'\' ');
$this->addSql('ALTER TABLE activity ALTER attendee TYPE INT USING CASE WHEN attendee is false THEN 2 WHEN attendee is true THEN 1 ELSE null END');
$this->addSql('ALTER TABLE activity RENAME COLUMN attendee TO attendee_id');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095ABCFD782A FOREIGN KEY (attendee_id) REFERENCES activitytpresence (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema) : void
{
$this->addSql('ALTER TABLE activity DROP emergency');
$this->addSql('ALTER TABLE activity DROP CONSTRAINT FK_AC74095ABCFD782A');
$this->addSql('ALTER TABLE activity ADD attendee BOOLEAN DEFAULT NULL');
$this->addSql('ALTER TABLE activity DROP attendee_id');
$this->addSql('ALTER TABLE activity DROP sentReceived');
$this->addSql('DROP SEQUENCE activitytpresence_id_seq CASCADE');
$this->addSql('DROP TABLE activitytpresence');
}
}

View File

@@ -0,0 +1,65 @@
<?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 Version20210422123846 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql('CREATE TABLE activity_person (activity_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(activity_id, person_id))');
$this->addSql('CREATE INDEX IDX_66AA317681C06096 ON activity_person (activity_id)');
$this->addSql('CREATE INDEX IDX_66AA3176217BBB47 ON activity_person (person_id)');
$this->addSql('CREATE TABLE activity_thirdparty (activity_id INT NOT NULL, thirdparty_id INT NOT NULL, PRIMARY KEY(activity_id, thirdparty_id))');
$this->addSql('CREATE INDEX IDX_C6F0DE0381C06096 ON activity_thirdparty (activity_id)');
$this->addSql('CREATE INDEX IDX_C6F0DE03C7D3A8E6 ON activity_thirdparty (thirdparty_id)');
$this->addSql('CREATE TABLE activity_document (activity_id INT NOT NULL, document_id INT NOT NULL, PRIMARY KEY(activity_id, document_id))');
$this->addSql('CREATE INDEX IDX_78633A7881C06096 ON activity_document (activity_id)');
$this->addSql('CREATE INDEX IDX_78633A78C33F7837 ON activity_document (document_id)');
$this->addSql('CREATE TABLE activity_user (activity_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(activity_id, user_id))');
$this->addSql('CREATE INDEX IDX_8E570DDB81C06096 ON activity_user (activity_id)');
$this->addSql('CREATE INDEX IDX_8E570DDBA76ED395 ON activity_user (user_id)');
$this->addSql('ALTER TABLE activity_person ADD CONSTRAINT FK_66AA317681C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity_person ADD CONSTRAINT FK_66AA3176217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity_thirdparty ADD CONSTRAINT FK_C6F0DE0381C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity_thirdparty ADD CONSTRAINT FK_C6F0DE03C7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT FK_78633A7881C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
#$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT FK_78633A78C33F7837 FOREIGN KEY (document_id) REFERENCES Document (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity_user ADD CONSTRAINT FK_8E570DDB81C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity_user ADD CONSTRAINT FK_8E570DDBA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE activity ADD travelTime TIME(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE activitytype ADD travelTimeVisible SMALLINT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD travelTimeLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD usersVisible SMALLINT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD usersLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
}
public function down(Schema $schema) : void
{
$this->addSql('DROP TABLE activity_person');
$this->addSql('DROP TABLE activity_thirdparty');
$this->addSql('DROP TABLE activity_document');
$this->addSql('DROP TABLE activity_user');
$this->addSql('ALTER TABLE activity DROP travelTime');
$this->addSql('ALTER TABLE activitytype DROP travelTimeVisible');
$this->addSql('ALTER TABLE activitytype DROP travelTimeLabel');
$this->addSql('ALTER TABLE activitytype DROP usersVisible');
$this->addSql('ALTER TABLE activitytype DROP usersLabel');
}
}