You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
229 lines
3.9 KiB
229 lines
3.9 KiB
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
namespace Chamilo\CourseBundle\Entity;
|
|
|
|
use Chamilo\CoreBundle\Entity\AbstractResource;
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* CForumAttachment.
|
|
*
|
|
* @ORM\Table(
|
|
* name="c_forum_attachment",
|
|
* indexes={
|
|
* @ORM\Index(name="course", columns={"c_id"})
|
|
* }
|
|
* )
|
|
* @ORM\Entity
|
|
*/
|
|
class CForumAttachment extends AbstractResource implements ResourceInterface
|
|
{
|
|
/**
|
|
* @ORM\Column(name="iid", type="integer")
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
*/
|
|
protected int $iid;
|
|
|
|
/**
|
|
* @ORM\Column(name="c_id", type="integer")
|
|
*/
|
|
protected int $cId;
|
|
|
|
/**
|
|
* @ORM\Column(name="path", type="string", length=255, nullable=false)
|
|
*/
|
|
protected string $path;
|
|
|
|
/**
|
|
* @ORM\Column(name="comment", type="text", nullable=true)
|
|
*/
|
|
protected ?string $comment;
|
|
|
|
/**
|
|
* @ORM\Column(name="size", type="integer", nullable=false)
|
|
*/
|
|
protected int $size;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", cascade={"persist"}, inversedBy="attachments")
|
|
* @ORM\JoinColumn(name="post_id", referencedColumnName="iid", onDelete="CASCADE")
|
|
*/
|
|
protected CForumPost $post;
|
|
|
|
/**
|
|
* @ORM\Column(name="filename", type="string", length=255, nullable=false)
|
|
*/
|
|
protected string $filename;
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return (string) $this->getFilename();
|
|
}
|
|
|
|
/**
|
|
* Get iid.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getIid()
|
|
{
|
|
return $this->iid;
|
|
}
|
|
|
|
/**
|
|
* Set path.
|
|
*
|
|
* @param string $path
|
|
*
|
|
* @return CForumAttachment
|
|
*/
|
|
public function setPath($path)
|
|
{
|
|
$this->path = $path;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get path.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getPath()
|
|
{
|
|
return $this->path;
|
|
}
|
|
|
|
/**
|
|
* Set comment.
|
|
*
|
|
* @param string $comment
|
|
*
|
|
* @return CForumAttachment
|
|
*/
|
|
public function setComment($comment)
|
|
{
|
|
$this->comment = $comment;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get comment.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getComment()
|
|
{
|
|
return $this->comment;
|
|
}
|
|
|
|
/**
|
|
* Set size.
|
|
*
|
|
* @param int $size
|
|
*
|
|
* @return CForumAttachment
|
|
*/
|
|
public function setSize($size)
|
|
{
|
|
$this->size = $size;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get size.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getSize()
|
|
{
|
|
return $this->size;
|
|
}
|
|
|
|
/**
|
|
* Set filename.
|
|
*
|
|
* @param string $filename
|
|
*
|
|
* @return CForumAttachment
|
|
*/
|
|
public function setFilename($filename)
|
|
{
|
|
$this->filename = $filename;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get filename.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getFilename()
|
|
{
|
|
return $this->filename;
|
|
}
|
|
|
|
/**
|
|
* Set cId.
|
|
*
|
|
* @param int $cId
|
|
*
|
|
* @return CForumAttachment
|
|
*/
|
|
public function setCId($cId)
|
|
{
|
|
$this->cId = $cId;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get cId.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getCId()
|
|
{
|
|
return $this->cId;
|
|
}
|
|
|
|
public function getPost(): CForumPost
|
|
{
|
|
return $this->post;
|
|
}
|
|
|
|
public function setPost(CForumPost $post): self
|
|
{
|
|
$this->post = $post;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getResourceIdentifier(): int
|
|
{
|
|
return $this->getIid();
|
|
}
|
|
|
|
public function getResourceName(): string
|
|
{
|
|
return $this->getFilename();
|
|
}
|
|
|
|
public function setResourceName(string $name): self
|
|
{
|
|
return $this->setFilename($name);
|
|
}
|
|
}
|
|
|