mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
102 lines
2.1 KiB
PHP
102 lines
2.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\DocStoreBundle\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* @ORM\Table("chill_doc.document_category")
|
|
* @ORM\Entity(repositoryClass="Chill\DocStoreBundle\EntityRepository\DocumentCategoryRepository")
|
|
*/
|
|
class DocumentCategory
|
|
{
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="string", name="bundle_id")
|
|
*
|
|
* @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....)
|
|
*/
|
|
private $bundleId;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", name="document_class")
|
|
*
|
|
* @var string The class of the document (ie Chill\DocStoreBundle\PersonDocument)
|
|
*/
|
|
private $documentClass;
|
|
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer", name="id_inside_bundle")
|
|
*
|
|
* @var int The id which is unique inside the bundle
|
|
*/
|
|
private $idInsideBundle;
|
|
|
|
/**
|
|
* @ORM\Column(type="json")
|
|
*/
|
|
private $name;
|
|
|
|
public function __construct($bundleId, $idInsideBundle)
|
|
{
|
|
$this->bundleId = $bundleId;
|
|
$this->idInsideBundle = $idInsideBundle;
|
|
}
|
|
|
|
public function getBundleId() // ::class BundleClass (FQDN)
|
|
{
|
|
return $this->bundleId;
|
|
}
|
|
|
|
public function getDocumentClass()
|
|
{
|
|
return $this->documentClass;
|
|
}
|
|
|
|
public function getIdInsideBundle()
|
|
{
|
|
return $this->idInsideBundle;
|
|
}
|
|
|
|
public function getName($locale = null)
|
|
{
|
|
if ($locale) {
|
|
if (isset($this->name[$locale])) {
|
|
return $this->name[$locale];
|
|
}
|
|
|
|
foreach ($this->name as $name) {
|
|
if (!empty($name)) {
|
|
return $name;
|
|
}
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
return $this->name;
|
|
}
|
|
|
|
public function setDocumentClass($documentClass): self
|
|
{
|
|
$this->documentClass = $documentClass;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setName($name): self
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
}
|