Forum - fix entities

pull/3733/head
Julio Montoya 5 years ago
parent dc6a8a608e
commit 212aa3e1bd
  1. 2
      src/CoreBundle/Entity/User.php
  2. 5
      src/CoreBundle/Migrations/Schema/V200/Version20180927172830.php
  3. 27
      src/CourseBundle/Entity/CForumForum.php
  4. 6
      src/CourseBundle/Entity/CForumThread.php
  5. 25
      src/CourseBundle/Entity/CLp.php
  6. 7
      src/CourseBundle/Entity/CLpCategory.php

@ -2304,7 +2304,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface
public function getProfileUrl(): string
{
return '/social/profile.php?u='.$this->id;
return '/main/social/profile.php?u='.$this->id;
}
public function getIconStatus(): string

@ -51,6 +51,11 @@ class Version20180927172830 extends AbstractMigrationChamilo
);
}
$this->addSql('ALTER TABLE c_forum_forum CHANGE lp_id lp_id INT DEFAULT NULL');
if (false === $table->hasForeignKey('FK_47A9C9968DFD1EF')) {
$this->addSql('ALTER TABLE c_forum_forum ADD CONSTRAINT FK_47A9C9968DFD1EF FOREIGN KEY (lp_id) REFERENCES c_lp (iid)');
}
if (false === $table->hasIndex('IDX_47A9C9921BF9426')) {
$this->addSql('CREATE INDEX IDX_47A9C9921BF9426 ON c_forum_forum (forum_category)');
}

@ -188,11 +188,10 @@ class CForumForum extends AbstractResource implements ResourceInterface
protected $endTime;
/**
* @var int
*
* @ORM\Column(name="lp_id", type="integer", options={"unsigned":true})
* @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CLp", inversedBy="forum")
* @ORM\JoinColumn(name="lp_id", referencedColumnName="iid")
*/
protected $lpId;
protected $lp;
/**
* @var bool
@ -780,6 +779,26 @@ class CForumForum extends AbstractResource implements ResourceInterface
return $this;
}
public function getLp(): ?CLp
{
return $this->lp;
}
public function setLp(CLp $lp): self
{
$this->lp = $lp;
return $this;
}
/**
* @return CForumPost[]|ArrayCollection
*/
public function getPosts()
{
return $this->posts;
}
public function getResourceIdentifier(): int
{
return $this->getIid();

@ -420,10 +420,8 @@ class CForumThread extends AbstractResource implements ResourceInterface
* Set threadQualifyMax.
*
* @param float $threadQualifyMax
*
* @return CForumThread
*/
public function setThreadQualifyMax($threadQualifyMax)
public function setThreadQualifyMax($threadQualifyMax): self
{
$this->threadQualifyMax = $threadQualifyMax;
@ -471,7 +469,7 @@ class CForumThread extends AbstractResource implements ResourceInterface
*
* @return CForumThread
*/
public function setThreadWeight($threadWeight)
public function setThreadWeight($threadWeight): self
{
$this->threadWeight = $threadWeight;

@ -281,8 +281,11 @@ class CLp extends AbstractResource implements ResourceInterface
protected $items;
/**
* Constructor.
* @var CForumForum
* @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", mappedBy="lp")
*/
protected $forum;
public function __construct()
{
$this->accumulateScormTime = 1;
@ -1080,9 +1083,23 @@ class CLp extends AbstractResource implements ResourceInterface
return $this->subscribeUsers;
}
/**
* Resource identifier.
*/
public function getForum(): ?CForumForum
{
return $this->forum;
}
public function hasForum(): bool
{
return null !== $this->forum;
}
public function setForum(CForumForum $forum): self
{
$this->forum = $forum;
return $this;
}
public function getResourceIdentifier(): int
{
return $this->getIid();

@ -61,7 +61,12 @@ class CLpCategory extends AbstractResource implements ResourceInterface
protected $position;
/**
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CLpCategoryUser", mappedBy="category", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OneToMany(
* targetEntity="Chamilo\CourseBundle\Entity\CLpCategoryUser",
* mappedBy="category",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
*/
protected $users;

Loading…
Cancel
Save