1. Go to this page and download the library: Download madmis/activity-log-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
madmis / activity-log-bundle example snippets
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use ActivityLogBundle\Entity\Interfaces\StringableInterface;
/**
* @package AppBundle\Entity
* @ORM\Entity(repositoryClass="ProjectRepository")
* @ORM\Table
* @Gedmo\Loggable(logEntryClass="ActivityLogBundle\Entity\LogEntry")
*/
class Project implements StringableInterface
{
/**
* @var int
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @ORM\Column(type="string", length=128)
* @Gedmo\Versioned
*/
private $name;
/**
* @var string
* @ORM\Column(type="string", length=16)
* @Gedmo\Versioned
*/
private $key;
//...
namespace AppBundle\Service\ActivityFormatter;
class Project extends AbstractFormatter implements FormatterInterface
{
//...
/**
* @param array $value
* @return string
*/
protected function type(array $value)
{
if (isset($value['id'])) {
/** @var Type $entity */
$entity = $this->entityManager->getRepository('AppBundle:Type')
->find($value['id']);
if ($entity) {
return $entity->getName();
}
}
return '';
}
$em = $this->getDoctrine()->getManager();
// get log entries for entity
$entries = $em
->getRepository('AppBundle:LogEntry')
->getLogEntriesQueryBuilder($entity)
->getQuery()
->getResult();
// format log entries to show in the view
$entries = $this
->get('activity_log.formatter')
->format($entries);
php
public function registerBundles()
{
$bundles = [
// ...
new ActivityLogBundle\ActivityLogBundle(),
// ...
];
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.