diff --git a/Entity/Activity.php b/Entity/Activity.php
index a1eeae47b..dfb28301a 100644
--- a/Entity/Activity.php
+++ b/Entity/Activity.php
@@ -1,25 +1,26 @@
- *
+ *
* 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 .
*/
namespace Chill\ActivityBundle\Entity;
+use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
@@ -109,16 +110,21 @@ class Activity implements HasCenterInterface, HasScopeInterface
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private $person;
-
+
+ /**
+ * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
+ */
+ private $comment;
+
/**
* Activity constructor.
*/
public function __construct()
{
$this->reasons = new ArrayCollection();
+ $this->comment = new CommentEmbeddable();
}
-
/**
* Get id
*
@@ -256,7 +262,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
-
+
/**
* @param ActivityReason $reason
*/
@@ -343,16 +349,32 @@ class Activity implements HasCenterInterface, HasScopeInterface
{
return $this->person;
}
-
+
/**
* get the center
* center is extracted from person
- *
+ *
* @return Center
*/
public function getCenter()
{
return $this->person->getCenter();
}
+
+ /**
+ * @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
+ */
+ public function getComment()
+ {
+ return $this->comment;
+ }
+
+ /**
+ * @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
+ */
+ public function setComment($comment)
+ {
+ $this->comment = $comment;
+ }
}
diff --git a/Form/ActivityType.php b/Form/ActivityType.php
index 86d345c25..e2d660f3f 100644
--- a/Form/ActivityType.php
+++ b/Form/ActivityType.php
@@ -2,6 +2,7 @@
namespace Chill\ActivityBundle\Form;
+use Chill\MainBundle\Form\Type\CommentType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -106,7 +107,7 @@ class ActivityType extends AbstractType
))
->add('user', UserPickerType::class, [
'center' => $options['center'],
- 'role' => $options['role']
+ 'role' => $options['role']
])
->add('scope', ScopePickerType::class, [
'center' => $options['center'],
@@ -120,6 +121,9 @@ class ActivityType extends AbstractType
'placeholder' => 'Choose a type',
'active_only' => true
))
+ ->add('comment', CommentType::class, [
+ 'required' => false,
+ ])
;
$builder->get('durationTime')
diff --git a/Resources/views/Activity/edit.html.twig b/Resources/views/Activity/edit.html.twig
index 3f7d3d664..5a70d3f81 100644
--- a/Resources/views/Activity/edit.html.twig
+++ b/Resources/views/Activity/edit.html.twig
@@ -1,16 +1,16 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS,
- *
+ *
* 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 .
#}
@@ -22,9 +22,9 @@
{% block personcontent %}
diff --git a/Resources/views/Activity/new.html.twig b/Resources/views/Activity/new.html.twig
index b77e352d6..1ec0b0c90 100644
--- a/Resources/views/Activity/new.html.twig
+++ b/Resources/views/Activity/new.html.twig
@@ -1,16 +1,16 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS,
- *
+ *
* 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 .
#}
@@ -24,27 +24,28 @@