I use Loggable to backup changes in Entities.
The default AbstractLogEntry
does not have enough columns for my needs.
Thats why i extended the class and added extra getters and setters.
See the code below
/**
* EmployeeBackup
*
* @ORM\Table(name="employee_backup")
* @ORM\Entity(repositoryClass="Gedmo\Loggable\Entity\Repository\LogEntryRepository")
*
*/
class EmployeeBackup extends AbstractLogEntry
{
/**
* @var int
*
* @ORM\Column(name="division_id", type="integer", unique=true)
*/
private $divisionId;
/**
* @return int
*/
public function getDivisionId(): int
{
return $this->divisionId;
}
/**
* @param string $divisionId
*/
public function setDivisionId(string $divisionId): void
{
$this->divisionId = $divisionId;
}
}
The extension is using the class above. So it works.
But now i need to set the divisionId
when a new version is stored.
I tried the code below
$loggable = new LoggableListener();
$loggable->setDivision($division);
$evm->addEventSubscriber($loggable);
And this is what i get:
Attempted to call an undefined method named "setDivision" of class "Gedmo\Loggable\LoggableListener".
And thats true because LoggableListener
does not have a setDivision
function. My question is: Do i need to override the listener and if so, how do i do that?
Thanks ;)