ruspanzer / loggable-bundle
Doctrine simple loggable entities
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.1
- doctrine/doctrine-bundle: ^1.11
- doctrine/orm: ^2.5
- symfony/event-dispatcher: ^4.3
- symfony/security-bundle: ^4.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- phpstan/phpstan: ^0.11.19
README
Simple entity loggable bundle
How to use:
- Install bundle
composer require ruspanzer/loggable-bundle
- Implement
Ruspanzer\LoggableBundle\Entity\Interfaces\LoggableInterface
for you entity - If you need set relations between two loggable entities, use
getRelatedLogEntities
in related entity. This method must be return array ofLoggableInterface
entities. It will allow search related logs when searching main entity - Find logs with repository method getByObject(). Or you can write your search implementation with pagination and other cool features :-)
Example:
class Place implements LoggableInterface
{
/**
* @ORM\Id()
*/
private $id;
/**
* @ORM\OneToOne(targetEntity="Address")
*/
private $address;
public function getId()
{
return $this->id;
}
public function getRelatedLogEntities()
{
return [];
}
}
class Address implements LoggableInterface
{
/**
* @ORM\Id()
*/
private $id;
/**
* @ORM\OneToOne(targetEntity="Place")
* @ORM\JoinColumn(name="place_id")
*/
private $place;
public function getId()
{
return $this->id;
}
public function getPlace()
{
return $this->place;
}
public function getRelatedLogEntities()
{
return [
$this->getPlace();
];
}
}
If you will be search logs by Place, Address logs to be returned
This bundle also working with StofDoctrineExtensions Softdeleteable