Fixed: [accompanying course document] fix access to accompanying course document

The entity AccompanyingCourseDocument didn't had any center associated with this entity. Implementing the interface `HasCenterInterface` fixed the problem.

Fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/83
This commit is contained in:
2023-04-05 19:29:33 +02:00
parent 907c724047
commit 386d1e44d0
4 changed files with 39 additions and 45 deletions

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Entity;
use Chill\MainBundle\Entity\HasCentersInterface;
use Chill\MainBundle\Entity\HasScopesInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
@@ -19,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Entity
* @ORM\Table("chill_doc.accompanyingcourse_document")
*/
class AccompanyingCourseDocument extends Document implements HasScopesInterface
class AccompanyingCourseDocument extends Document implements HasScopesInterface, HasCentersInterface
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
@@ -27,6 +28,11 @@ class AccompanyingCourseDocument extends Document implements HasScopesInterface
*/
private ?AccompanyingPeriod $course = null;
public function getCenters(): ?iterable
{
return $this->course->getCenters();
}
public function getCourse(): ?AccompanyingPeriod
{
return $this->course;