PHP code example of adt / doctrine-loggable

1. Go to this page and download the library: Download adt/doctrine-loggable 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/ */

    

adt / doctrine-loggable example snippets




use Doctrine\ORM\Mapping as ORM;
use Adt\DoctrineLoggable\Annotations as ADA;
	
/**
 * @ORM\Entity
 * @ADA\LoggableEntity
 */
class User
{

	/**
	 * @ORM\Column(type="string", nullable=true)
	 * @ADA\LoggableProperty(label="entity.user.firstname")
	 */
	protected $firstname;

	/**
	 * @ORM\ManyToMany(targetEntity="Role", inversedBy="users")
	 * @ADA\LoggableProperty(logEntity=false, label="entity.user.roles")
	 */
	protected $roles;
	
}

/**
 * @ORM\Entity
 * @ADA\LoggableIdentification(fields={"name"})
 */
class Role
{

	/**
	 * @ORM\Column(type="string")
	 */
	protected $name;

	/**
	 * @ORM\ManyToMany(targetEntity="User", mappedBy="roles")
	 */
	protected $users;

}