diff --git a/main/inc/lib/PortfolioController.php b/main/inc/lib/PortfolioController.php index a9580509738..53b3675a6e6 100644 --- a/main/inc/lib/PortfolioController.php +++ b/main/inc/lib/PortfolioController.php @@ -1203,12 +1203,18 @@ public function view(Portfolio $item) ; } - $comments = $commentsQueryBuilder - ->orderBy('comment.root, comment.lft', 'ASC') - ->setParameter('item', $item) - ->getQuery() - ->getArrayResult() - ; + if (true === api_get_configuration_value('portfolio_show_base_course_post_in_sessions') + && $this->session && !$item->getSession() && !$item->isDuplicatedInSession($this->session) + ) { + $comments = []; + } else { + $comments = $commentsQueryBuilder + ->orderBy('comment.root, comment.lft', 'ASC') + ->setParameter('item', $item) + ->getQuery() + ->getArrayResult() + ; + } $clockIcon = Display::returnFontAwesomeIcon('clock-o', '', true); @@ -3762,6 +3768,9 @@ private function getItemsForIndex( $currentUserId = api_get_user_id(); if ($this->course) { + $showBaseContentInSession = $this->session + && true === api_get_configuration_value('portfolio_show_base_course_post_in_sessions'); + $queryBuilder = $this->em->createQueryBuilder(); $queryBuilder ->select('pi') @@ -3771,7 +3780,9 @@ private function getItemsForIndex( $queryBuilder->setParameter('course', $this->course); if ($this->session) { - $queryBuilder->andWhere('pi.session = :session'); + $queryBuilder->andWhere( + $showBaseContentInSession ? 'pi.session = :session OR pi.session IS NULL' : 'pi.session = :session' + ); $queryBuilder->setParameter('session', $this->session); } else { $queryBuilder->andWhere('pi.session IS NULL'); @@ -3894,6 +3905,15 @@ private function getItemsForIndex( $queryBuilder->orderBy('pi.creationDate', 'DESC'); $items = $queryBuilder->getQuery()->getResult(); + + if ($showBaseContentInSession) { + $items = array_filter( + $items, + fn(Portfolio $item) => !($this->session && !$item->getSession() && $item->isDuplicatedInSession($this->session)) + ); + } + + return $items; } else { $itemsCriteria = []; $itemsCriteria['category'] = null; @@ -3954,6 +3974,20 @@ private function createCommentForm(Portfolio $item): string $form->addButtonSave(get_lang('Save')); if ($form->validate()) { + if ($this->session + && true === api_get_configuration_value('portfolio_show_base_course_post_in_sessions') + && !$item->getSession() + ) { + $duplicate = $item->duplicateInSession($this->session); + + $this->em->persist($duplicate); + $this->em->flush(); + + $item = $duplicate; + + $formAction = $this->baseUrl.http_build_query(['action' => 'view', 'id' => $item->getId()]); + } + $values = $form->exportValues(); $parentComment = $this->em->find(PortfolioComment::class, $values['parent']); diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 80d3faf5647..15f53a60c9f 100644 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -1132,6 +1132,14 @@ // ALTER TABLE portfolio_comment ADD visibility SMALLINT DEFAULT 1 NOT NULL; // Then add the "@" symbol to the CPortfolioComment::$visibility property in the ORM\Column() line. //$_configuration['portfolio_advanced_sharing'] = false; +// Show base course posts in session course. Requires DB changes and edit the Portfolio entity +// adding the "@" symbol to the beginning of ORM\ManyToOne, ORM\JoinColumn, ORM\OneToMany lines for the Portfolio::$duplicatedFrom and Portfolio::$duplicates properties. +/* +ALTER TABLE portfolio ADD duplicated_from INT DEFAULT NULL; +ALTER TABLE portfolio ADD CONSTRAINT FK_A9ED1062FC4CB679 FOREIGN KEY (duplicated_from) REFERENCES portfolio (id) ON DELETE SET NULL; +CREATE INDEX IDX_A9ED1062FC4CB679 ON portfolio (duplicated_from); +*/ +//$_configuration['portfolio_show_base_course_post_in_sessions'] = false; // DEPRECATED: gradebook_enable_best_score is deprecated. Use gradebook_display_extra_stats instead. // Enable best score column in gradebook. Previously called disable_gradebook_stats diff --git a/main/template/default/portfolio/items.html.twig b/main/template/default/portfolio/items.html.twig index 2fe874dd2c2..f1baabeb172 100644 --- a/main/template/default/portfolio/items.html.twig +++ b/main/template/default/portfolio/items.html.twig @@ -11,6 +11,12 @@ {% set item_url = baseurl ~ {'action':'view', 'id':item.id}|url_encode %} {% set comments = item.lastComments(3, is_advanced_sharing_enabled) %} + {% if 'portfolio_show_base_course_post_in_sessions'|api_get_configuration_value %} + {% if _c.session_id and not item.session and not item.isDuplicatedInSessionId(_c.session_id) %} + {% set comments = {} %} + {% endif %} + {% endif %} +
diff --git a/src/Chamilo/CoreBundle/Entity/Portfolio.php b/src/Chamilo/CoreBundle/Entity/Portfolio.php index bce121320b9..a4045ac4735 100644 --- a/src/Chamilo/CoreBundle/Entity/Portfolio.php +++ b/src/Chamilo/CoreBundle/Entity/Portfolio.php @@ -4,6 +4,7 @@ namespace Chamilo\CoreBundle\Entity; use Chamilo\UserBundle\Entity\User; +use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; @@ -37,120 +38,102 @@ class Portfolio public const VISIBILITY_PER_USER = 3; /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue */ - protected $id; + protected ?int $id; /** - * @var string - * * @ORM\Column(name="title", type="string", length=255) */ - protected $title; + protected string $title; /** - * @var string * @ORM\Column(name="content", type="text") */ - protected $content; + protected string $content; /** - * @var User - * * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ - protected $user; + protected User $user; /** - * @var Course - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE") */ - protected $course = null; + protected ?Course $course = null; /** - * @var Session - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") */ - protected $session = null; + protected ?Session $session = null; /** - * @var \DateTime - * * @ORM\Column(name="creation_date", type="datetime") */ - protected $creationDate; + protected DateTime $creationDate; /** - * @var \DateTime - * * @ORM\Column(name="update_date", type="datetime") */ - protected $updateDate; + protected DateTime $updateDate; /** - * @var int - * * @ORM\Column(name="visibility", type="smallint", options={"default": 1}) */ - protected $visibility = 1; + protected int $visibility = self::VISIBILITY_VISIBLE; /** - * @var \Chamilo\CoreBundle\Entity\PortfolioCategory - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\PortfolioCategory", inversedBy="items") * @ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="SET NULL") */ - protected $category; + protected ?PortfolioCategory $category; /** - * @var \Doctrine\Common\Collections\ArrayCollection - * * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\PortfolioComment", mappedBy="item") */ - private $comments; + private Collection $comments; /** - * @var int|null - * * @ORM\Column(name="origin", type="integer", nullable=true) */ - private $origin; + private ?int $origin = null; + /** - * @var int|null - * * @ORM\Column(name="origin_type", type="integer", nullable=true) */ - private $originType; + private ?int $originType = null; /** - * @var float|null - * * @ORM\Column(name="score", type="float", nullable=true) */ - private $score; + private ?float $score = null; /** - * @var bool - * * @ORM\Column(name="is_highlighted", type="boolean", options={"default": false}) */ - private $isHighlighted = false; + private bool $isHighlighted = false; /** - * @var bool - * * @ORM\Column(name="is_template", type="boolean", options={"default": false}) */ - private $isTemplate = false; + private bool $isTemplate = false; + + /** + * ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Portfolio", inversedBy="duplicates") + * ORM\JoinColumn(name="duplicated_from", onDelete="SET NULL") + */ + private ?Portfolio $duplicatedFrom = null; + + /** + * @var Collection + * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Portfolio", mappedBy="duplicatedFrom") + */ + private Collection $duplicates; /** * Portfolio constructor. @@ -159,91 +142,52 @@ public function __construct() { $this->category = null; $this->comments = new ArrayCollection(); + $this->duplicates = new ArrayCollection(); } - /** - * Set user. - * - * @return Portfolio - */ - public function setUser(User $user) + public function setUser(User $user): Portfolio { $this->user = $user; return $this; } - /** - * Get user. - * - * @return User - */ - public function getUser() + public function getUser(): User { return $this->user; } - /** - * Set course. - * - * @return Portfolio - */ - public function setCourse(Course $course = null) + public function setCourse(?Course $course = null): Portfolio { $this->course = $course; return $this; } - /** - * Get course. - * - * @return Course - */ - public function getCourse() + public function getCourse(): ?Course { return $this->course; } - /** - * Get session. - * - * @return Session - */ - public function getSession() + public function getSession(): ?Session { return $this->session; } - /** - * Set session. - * - * @return Portfolio - */ - public function setSession(Session $session = null) + public function setSession(?Session $session = null): Portfolio { $this->session = $session; return $this; } - /** - * Set title. - * - * @param string $title - * - * @return Portfolio - */ - public function setTitle($title) + public function setTitle(string $title): Portfolio { $this->title = $title; return $this; } - /** - * Get title. - */ public function getTitle(bool $stripTags = false): string { if ($stripTags) { @@ -253,87 +197,47 @@ public function getTitle(bool $stripTags = false): string return $this->title; } - /** - * Set content. - * - * @param string $content - * - * @return Portfolio - */ - public function setContent($content) + public function setContent(string $content): Portfolio { $this->content = $content; return $this; } - /** - * Get content. - * - * @return string - */ - public function getContent() + public function getContent(): string { return $this->content; } - /** - * Set creationDate. - * - * @return Portfolio - */ - public function setCreationDate(\DateTime $creationDate) + public function setCreationDate(DateTime $creationDate): Portfolio { $this->creationDate = $creationDate; return $this; } - /** - * Get creationDate. - * - * @return \DateTime - */ - public function getCreationDate() + public function getCreationDate(): DateTime { return $this->creationDate; } - /** - * Set updateDate. - * - * @return Portfolio - */ - public function setUpdateDate(\DateTime $updateDate) + public function setUpdateDate(DateTime $updateDate): Portfolio { $this->updateDate = $updateDate; return $this; } - /** - * Get updateDate. - * - * @return \DateTime - */ - public function getUpdateDate() + public function getUpdateDate(): DateTime { return $this->updateDate; } - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): ?int { return $this->id; } - /** - * Set isVisible. - */ public function setVisibility(int $visibility): Portfolio { $this->visibility = $visibility; @@ -341,30 +245,17 @@ public function setVisibility(int $visibility): Portfolio return $this; } - /** - * Get isVisible. - */ public function getVisibility(): int { return $this->visibility; } - /** - * Get category. - * - * @return PortfolioCategory - */ - public function getCategory() + public function getCategory(): ?PortfolioCategory { return $this->category; } - /** - * Set category. - * - * @return Portfolio - */ - public function setCategory(PortfolioCategory $category = null) + public function setCategory(?PortfolioCategory $category = null): Portfolio { $this->category = $category; @@ -397,9 +288,6 @@ public function getOrigin(): ?int return $this->origin; } - /** - * @return \Chamilo\CoreBundle\Entity\Portfolio - */ public function setOrigin(?int $origin): Portfolio { $this->origin = $origin; @@ -412,9 +300,6 @@ public function getOriginType(): ?int return $this->originType; } - /** - * @return \Chamilo\CoreBundle\Entity\Portfolio - */ public function setOriginType(?int $originType): Portfolio { $this->originType = $originType; @@ -460,4 +345,84 @@ public function setIsTemplate(bool $isTemplate): Portfolio return $this; } + + public function getDuplicatedFrom(): ?Portfolio + { + return $this->duplicatedFrom; + } + + public function setDuplicatedFrom(?Portfolio $duplicatedFrom): Portfolio + { + $this->duplicatedFrom = $duplicatedFrom; + + return $this; + } + + /** + * @return Collection + */ + public function getDuplicates(): Collection + { + return $this->duplicates; + } + + public function addDuplicate(Portfolio $duplicate): Portfolio + { + if (!$this->duplicates->contains($duplicate)) { + $this->duplicates->add($duplicate); + $duplicate->setDuplicatedFrom($this); + } + + return $this; + } + + public function removeDuplicate(Portfolio $duplicate): Portfolio + { + if ($this->duplicates->removeElement($duplicate)) { + // set the owning side to null (unless already changed) + if ($duplicate->getDuplicatedFrom() === $this) { + $duplicate->setDuplicatedFrom(null); + } + } + + return $this; + } + + public function hasDuplicates(): bool + { + return $this->duplicates->count() > 0; + } + + public function isDuplicated(): bool + { + return null !== $this->duplicatedFrom; + } + + public function isDuplicatedInSession(Session $session): bool + { + return $this->duplicates->exists(fn($key, Portfolio $duplicated): bool => $duplicated->session === $session); + } + + public function isDuplicatedInSessionId(int $sessionId): bool + { + return $this->duplicates->exists(fn($key, Portfolio $duplicated): bool => $duplicated->session && $duplicated->session->getId() === $sessionId); + } + + public function reset() + { + $this->id = null; + $this->duplicates = new ArrayCollection(); + $this->comments = new ArrayCollection(); + } + + public function duplicateInSession(Session $session): Portfolio + { + $duplicate = clone $this; + $duplicate->reset(); + + $duplicate->setSession($session); + $this->addDuplicate($duplicate); + + return $duplicate; + } } diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php b/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php index 2e9b630284d..590387c4849 100644 --- a/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php +++ b/src/Chamilo/CoreBundle/Entity/PortfolioAttachment.php @@ -21,52 +21,41 @@ class PortfolioAttachment public const TYPE_COMMENT = 2; /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue */ - protected $id; + protected ?int $id; /** - * @var string - * * @ORM\Column(name="path", type="string", length=255) */ - protected $path; + protected string $path; /** - * @var string|null - * * @ORM\Column(name="comment", type="text", nullable=true) */ - protected $comment; + protected ?string $comment; /** - * @var int - * * @ORM\Column(name="size", type="integer") */ - protected $size; + protected int $size; + /** - * @var string - * * @ORM\Column(name="filename", type="string", length=255) */ - protected $filename; + protected string $filename; + /** - * @var int - * * @ORM\Column(name="origin_id", type="integer") */ - private $origin; + private int $origin; + /** - * @var int - * * @ORM\Column(name="origin_type", type="integer") */ - private $originType; + private int $originType; public function getId(): int { diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php b/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php index 30f613c57ed..a1a3fb2ced3 100644 --- a/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php +++ b/src/Chamilo/CoreBundle/Entity/PortfolioCategory.php @@ -5,6 +5,7 @@ use Chamilo\UserBundle\Entity\User; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\Mapping as ORM; @@ -25,56 +26,42 @@ class PortfolioCategory { /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue */ - protected $id; + protected ?int $id; /** - * @var string - * * @ORM\Column(name="title", type="string", length=255) */ - protected $title; + protected string $title; /** - * @var null - * * @ORM\Column(name="description", type="text", nullable=true) */ - protected $description = null; + protected ?string $description = null; /** - * @var User - * * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ - protected $user; + protected User $user; /** - * @var bool - * * @ORM\Column(name="is_visible", type="boolean", options={"default": true}) */ - protected $isVisible = true; + protected bool $isVisible = true; /** - * @var int - * * @ORM\Column(name="parent_id", type="integer", nullable=false, options={"default": 0}) */ - protected $parentId = 0; + protected int $parentId = 0; /** - * @var \Doctrine\Common\Collections\ArrayCollection - * * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Portfolio", mappedBy="category") */ - protected $items; + protected Collection $items; /** * PortfolioCategory constructor. @@ -84,160 +71,84 @@ public function __construct() $this->items = new ArrayCollection(); } - /** - * @return string - */ - public function __toString() + public function __toString(): string { return $this->title; } - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): ?int { return $this->id; } - /** - * @param int $id - * - * @return PortfolioCategory - */ - public function setId($id) + public function setId(?int $id): PortfolioCategory { $this->id = $id; return $this; } - /** - * Get title. - * - * @return string - */ - public function getTitle() + public function getTitle(): string { return $this->title; } - /** - * Set title. - * - * @param string $title - * - * @return PortfolioCategory - */ - public function setTitle($title) + public function setTitle(string $title): PortfolioCategory { $this->title = $title; return $this; } - /** - * Get description. - * - * @return string|null - */ - public function getDescription() + public function getDescription(): ?string { return $this->description; } - /** - * Set description. - * - * @param string|null $description - * - * @return PortfolioCategory - */ - public function setDescription($description) + public function setDescription(?string $description): PortfolioCategory { $this->description = $description; return $this; } - /** - * Get user. - * - * @return User - */ - public function getUser() + public function getUser(): User { return $this->user; } - /** - * Set user. - * - * @return PortfolioCategory - */ - public function setUser(User $user) + public function setUser(User $user): PortfolioCategory { $this->user = $user; return $this; } - /** - * Get isVisible. - * - * @return bool - */ - public function isVisible() + public function isVisible(): bool { return $this->isVisible; } - /** - * Set isVisible. - * - * @param bool $isVisible - * - * @return PortfolioCategory - */ - public function setIsVisible($isVisible) + public function setIsVisible(bool $isVisible): PortfolioCategory { $this->isVisible = $isVisible; return $this; } - /** - * @return int - */ - public function getParentId() + public function getParentId(): int { return $this->parentId; } - /** - * Set parent id. - * - * @return PortfolioCategory - */ - public function setParentId(int $parentId) + public function setParentId(int $parentId): PortfolioCategory { $this->parentId = $parentId; return $this; } - /** - * Get items. - * - * @param \Chamilo\CoreBundle\Entity\Course|null $course - * @param \Chamilo\CoreBundle\Entity\Session|null $session - * @param bool $onlyVisibles - * - * @return ArrayCollection - */ - public function getItems(Course $course = null, Session $session = null, $onlyVisibles = false) + public function getItems(Course $course = null, Session $session = null, bool $onlyVisibles = false): Collection { $criteria = Criteria::create(); @@ -262,12 +173,7 @@ public function getItems(Course $course = null, Session $session = null, $onlyVi return $this->items->matching($criteria); } - /** - * Set items. - * - * @return PortfolioCategory - */ - public function setItems(ArrayCollection $items) + public function setItems(Collection $items): PortfolioCategory { $this->items = $items; diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioComment.php b/src/Chamilo/CoreBundle/Entity/PortfolioComment.php index 8ebdd71309d..8e5a03050a8 100644 --- a/src/Chamilo/CoreBundle/Entity/PortfolioComment.php +++ b/src/Chamilo/CoreBundle/Entity/PortfolioComment.php @@ -7,6 +7,7 @@ use Chamilo\UserBundle\Entity\User; use DateTime; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; @@ -26,111 +27,92 @@ class PortfolioComment public const VISIBILITY_PER_USER = 2; /** - * @var int - * * Add @ to the next line if portfolio_advanced_sharing config setting is true * ORM\Column(name="visibility", type="smallint", options={"default": 1}) */ - protected $visibility = 1; + protected int $visibility = 1; /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue */ - private $id; + private ?int $id; + /** - * @var \Chamilo\UserBundle\Entity\User - * * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") * @ORM\JoinColumn(name="author_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ - private $author; + private User $author; + /** - * @var \Chamilo\CoreBundle\Entity\Portfolio - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Portfolio", inversedBy="comments") * @ORM\JoinColumn(name="item_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ - private $item; + private Portfolio $item; + /** - * @var string - * * @ORM\Column(name="content", type="text") */ - private $content; + private string $content; + /** - * @var \DateTime - * * @ORM\Column(name="date", type="datetime") */ - private $date; + private DateTime $date; + /** - * @var bool - * * @ORM\Column(name="is_important", type="boolean", options={"default":false}) */ - private $isImportant; + private bool $isImportant; + /** - * @var int - * * @Gedmo\TreeLeft() * @ORM\Column(name="lft", type="integer") */ - private $lft; + private int $lft; + /** - * @var int - * * @Gedmo\TreeLevel() * @ORM\Column(name="lvl", type="integer") */ - private $lvl; + private int $lvl; + /** - * @var int - * * @Gedmo\TreeRight() * @ORM\Column(name="rgt", type="integer") */ - private $rgt; + private int $rgt; + /** - * @var \Chamilo\CoreBundle\Entity\PortfolioComment - * * @Gedmo\TreeRoot() * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\PortfolioComment") * @ORM\JoinColumn(name="tree_root", referencedColumnName="id", onDelete="CASCADE") */ - private $root; + private ?PortfolioComment $root = null; + /** - * @var \Chamilo\CoreBundle\Entity\PortfolioComment|null - * * @Gedmo\TreeParent() * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\PortfolioComment", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") */ - private $parent; + private ?PortfolioComment $parent; + /** - * @var \Doctrine\Common\Collections\ArrayCollection - * * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\PortfolioComment", mappedBy="parent") * @ORM\OrderBy({"lft"="DESC"}) */ - private $children; + private Collection $children; /** - * @var float|null - * * @ORM\Column(name="score", type="float", nullable=true) */ - private $score; + private ?float $score; /** - * @var bool - * * @ORM\Column(name="is_template", type="boolean", options={"default": false}) */ - private $isTemplate = false; + private bool $isTemplate = false; /** * PortfolioComment constructor. @@ -159,17 +141,11 @@ public function setAuthor(User $author): PortfolioComment return $this; } - /** - * @return \Chamilo\CoreBundle\Entity\Portfolio - */ public function getItem(): Portfolio { return $this->item; } - /** - * @param \Chamilo\CoreBundle\Entity\Portfolio $item - */ public function setItem(Portfolio $item): PortfolioComment { $this->item = $item; @@ -201,17 +177,11 @@ public function setDate(DateTime $date): PortfolioComment return $this; } - /** - * @return \Chamilo\CoreBundle\Entity\PortfolioComment|null - */ public function getParent(): ?PortfolioComment { return $this->parent; } - /** - * @param \Chamilo\CoreBundle\Entity\PortfolioComment|null $parent - */ public function setParent(?PortfolioComment $parent): PortfolioComment { $this->parent = $parent; @@ -256,9 +226,6 @@ public function setScore(?float $score): void $this->score = $score; } - /** - * @return \Chamilo\CoreBundle\Entity\PortfolioComment - */ public function getRoot(): PortfolioComment { return $this->root; diff --git a/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php b/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php index 0b0d59584b4..fb950d205c8 100644 --- a/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php +++ b/src/Chamilo/CoreBundle/Entity/PortfolioRelTag.php @@ -13,37 +13,29 @@ class PortfolioRelTag { /** - * @var int - * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue */ - protected $id; + protected ?int $id; /** - * @var Tag - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Tag") * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ - protected $tag; + protected Tag $tag; /** - * @var Course - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ - protected $course; + protected Course $course; /** - * @var Session|null - * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session") * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE") */ - protected $session; + protected ?Session $session; public function getId(): int {