PHP code example of zfcampus / zf-apigility-doctrine
1. Go to this page and download the library: Download zfcampus/zf-apigility-doctrine 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/ */
zfcampus / zf-apigility-doctrine example snippets
use ZF\Apigility\Doctrine\Server\Event\DoctrineResourceEvent;
$sharedEvents = $this->getApplication()->getEventManager()->getSharedManager();
$sharedEvents->attach(
'ZF\Apigility\Doctrine\DoctrineResource',
DoctrineResourceEvent::EVENT_CREATE_PRE,
function(DoctrineResourceEvent $e) {
$e->stopPropagation();
return new ApiProblem(400, 'Stop API Creation');
}
);