Spaces:
No application file
No application file
namespace Mautic\LeadBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Mautic\CategoryBundle\Entity\Category; | |
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; | |
class LeadCategory | |
{ | |
/** | |
* @var int | |
*/ | |
private $id; | |
/** | |
* @var Category | |
**/ | |
private $category; | |
/** | |
* @var Lead | |
*/ | |
private $lead; | |
/** | |
* @var \DateTimeInterface | |
*/ | |
private $dateAdded; | |
/** | |
* @var bool | |
*/ | |
private $manuallyRemoved = false; | |
/** | |
* @var bool | |
*/ | |
private $manuallyAdded = false; | |
public static function loadMetadata(ORM\ClassMetadata $metadata): void | |
{ | |
$builder = new ClassMetadataBuilder($metadata); | |
$builder->setTable('lead_categories') | |
->setCustomRepositoryClass(LeadCategoryRepository::class); | |
$builder->addId(); | |
$builder->createManyToOne('category', Category::class) | |
->addJoinColumn('category_id', 'id', false, false, 'CASCADE') | |
->build(); | |
$builder->addLead(false, 'CASCADE', false); | |
$builder->addDateAdded(); | |
$builder->createField('manuallyRemoved', 'boolean') | |
->columnName('manually_removed') | |
->build(); | |
$builder->createField('manuallyAdded', 'boolean') | |
->columnName('manually_added') | |
->build(); | |
} | |
/** | |
* @return mixed | |
*/ | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* @return \DateTimeInterface | |
*/ | |
public function getDateAdded() | |
{ | |
return $this->dateAdded; | |
} | |
/** | |
* @param \DateTime $date | |
*/ | |
public function setDateAdded($date): void | |
{ | |
$this->dateAdded = $date; | |
} | |
/** | |
* @return mixed | |
*/ | |
public function getLead() | |
{ | |
return $this->lead; | |
} | |
/** | |
* @param mixed $lead | |
*/ | |
public function setLead($lead): void | |
{ | |
$this->lead = $lead; | |
} | |
/** | |
* @return Category | |
*/ | |
public function getCategory() | |
{ | |
return $this->category; | |
} | |
/** | |
* @param Category $category | |
*/ | |
public function setCategory($category): void | |
{ | |
$this->category = $category; | |
} | |
/** | |
* @return bool | |
*/ | |
public function getManuallyRemoved() | |
{ | |
return $this->manuallyRemoved; | |
} | |
/** | |
* @param bool $manuallyRemoved | |
*/ | |
public function setManuallyRemoved($manuallyRemoved): void | |
{ | |
$this->manuallyRemoved = $manuallyRemoved; | |
} | |
/** | |
* @return bool | |
*/ | |
public function wasManuallyRemoved() | |
{ | |
return $this->manuallyRemoved; | |
} | |
/** | |
* @return bool | |
*/ | |
public function getManuallyAdded() | |
{ | |
return $this->manuallyAdded; | |
} | |
/** | |
* @param bool $manuallyAdded | |
*/ | |
public function setManuallyAdded($manuallyAdded): void | |
{ | |
$this->manuallyAdded = $manuallyAdded; | |
} | |
/** | |
* @return bool | |
*/ | |
public function wasManuallyAdded() | |
{ | |
return $this->manuallyAdded; | |
} | |
} | |