PHP code example of andreas-glaser / dc-event-bundle
1. Go to this page and download the library: Download andreas-glaser/dc-event-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/ */
andreas-glaser / dc-event-bundle example snippets
namespace AppBundle\Entity;
use AndreasGlaser\DCEventBundle\EventHandler\Annotations\DCEntityEventHandler;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="article")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ArticleRepository")
* @DCEntityEventHandler(class="AppBundle\EEH\ArticleEEH")
*/
class Article
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="subject", type="string", length=255)
*/
private $subject;
/**
* @var string
*
* @ORM\Column(name="body", type="text", nullable=true)
*/
private $body;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set subject
*
* @param string $subject
*
* @return Article
*/
public function setSubject($subject)
{
$this->subject = $subject;
return $this;
}
/**
* Get subject
*
* @return string
*/
public function getSubject()
{
return $this->subject;
}
/**
* Set body
*
* @param string $body
*
* @return Article
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
/**
* Get body
*
* @return string
*/
public function getBody()
{
return $this->body;
}
}
namespace AppBundle\EEH;
use AndreasGlaser\DCEventBundle\EventHandler\DCEntityEventHandlerBase;
use AndreasGlaser\DCEventBundle\Helper\ChangeSetHelper;
use AppBundle\Entity as AppBundleEntity;
/**
* Class ArticleEEH
*
* @package AppBundle\EEH
*/
class ArticleEEH extends DCEntityEventHandlerBase
{
/**
* @var AppBundleEntity\Article
*/
protected $entity;
/**
* @return void
*/
public function prePersist()
{
// TODO: Implement prePersist() method.
}
/**
* @return void
*/
public function postPersist()
{
// TODO: Implement postPersist() method.
}
/**
* @param \AndreasGlaser\DCEventBundle\Helper\ChangeSetHelper $changeSet
*
* @return void
*/
public function preUpdate(ChangeSetHelper $changeSet)
{
// TODO: Implement preUpdate() method.
}
/**
* @return void
*/
public function postUpdate()
{
// TODO: Implement postUpdate() method.
}
/**
* @return void
*/
public function preRemove()
{
// TODO: Implement preRemove() method.
}
/**
* @return void
*/
public function postRemove()
{
// TODO: Implement postRemove() method.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.