Add CommentEmbeddable to Activity (Ref #21)

This commit is contained in:
Jean-Francois Monfort
2021-03-11 12:30:11 +01:00
parent f4a76f659e
commit c1c3839c62
5 changed files with 66 additions and 32 deletions

View File

@@ -1,25 +1,26 @@
<?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 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;
}
}