Install via Composer
Add to your composer.json:
"require": {
"ais/pertemuandosenbundle": "dev-master"
}
Run:
composer update
Register the Bundle
Add to app/AppKernel.php:
new Ais\PertemuanDosenBundle\AisPertemuanDosenBundle(),
Ensure dependencies (NelmioApiDocBundle, FOSRestBundle, JMSSerializerBundle) are also registered.
Configure Routing
Add to app/config/routing.yml:
ais_pertemuandosens:
type: rest
prefix: /api
resource: "@AisPertemuanDosenBundle/Resources/config/routes.yml"
Access API Docs
Visit /api/doc (e.g., http://localhost/web/app_dev.php/api/doc) to explore endpoints.
Use the API to retrieve faculty meetings (PertemuanDosen) via:
/api/pertemuandosens – List all meetings./api/pertemuandosens/{id} – Fetch a single meeting by ID.Example (cURL):
curl -X GET http://localhost/api/pertemuandosens
CRUD Operations Leverage FOSRestBundle for standardized RESTful endpoints:
POST /api/pertemuandosens (with JSON payload).PUT /api/pertemuandosens/{id}.DELETE /api/pertemuandosens/{id}.Example payload:
{
"title": "Faculty Meeting",
"date": "2023-12-01",
"faculty": "Computer Science"
}
Serialization
Use JMS Serializer for custom data formatting. Override serialization groups in entities (e.g., @Serializer\ExclusionPolicy("ALL") for sensitive fields).
Validation
Integrate Symfony’s Validator component with entities (e.g., @Assert\NotBlank on required fields).
Event Listeners
Extend core logic via Doctrine lifecycle events (e.g., @PrePersist to auto-set timestamps).
AisPertemuanDosenBundle/Resources/config/doctrine/ for your schema./**
* @ApiDoc(
* resource=true,
* description="List all faculty meetings"
* )
*/
liip/functional-test-bundle for API endpoint tests. Example:
$client->request('GET', '/api/pertemuandosens');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
Symfony 2.7 Legacy
symfony/symfony:2.7.* in composer.json to avoid version conflicts.Missing Dependencies
NelmioApiDocBundle, FOSRestBundle, and JMSSerializerBundle are required but not auto-installed. Forgetting to register them causes 404 errors.AppKernel.php and run composer require for missing bundles.Route Overrides
The bundle’s routes.yml may conflict with existing routes. Prefix routes explicitly:
ais_pertemuandosens:
prefix: /api/v1
Serialization Issues Custom entities may fail serialization if not properly annotated. Example:
use JMS\Serializer\Annotation as Serializer;
class PertemuanDosen {
/**
* @Serializer\Type("string")
*/
private $date;
}
Enable Debug Mode
Set APP_DEBUG=true in .env to view detailed error logs (Symfony 2.7 uses app/config/parameters.yml).
Check Doctrine Events
Use doctrine:events:list to debug lifecycle callbacks:
php app/console doctrine:events:list
API Doc Errors Clear cache after adding new annotations:
php app/console cache:clear
Custom Entities
Extend the base PertemuanDosen entity by overriding the bundle’s Entity/PertemuanDosen.php in your project.
Additional Fields
Add fields to the entity and update the corresponding form/type classes (e.g., PertemuanDosenType.php).
Custom Controllers
Override bundle controllers by creating a Controller/ directory in your project and extending the bundle’s logic:
namespace AppBundle\Controller;
use Ais\PertemuanDosenBundle\Controller\PertemuanDosenController as BaseController;
class PertemuanDosenController extends BaseController {
public function customAction() { ... }
}
Event Subscribers
Listen to bundle events (e.g., pertemuan_dosen.pre_save) via Symfony’s event dispatcher:
$dispatcher->addListener('pertemuan_dosen.pre_save', function ($event) {
$event->getEntity()->setLastUpdated(new \DateTime());
});
How can I help you explore Laravel packages today?