RAD Bundle

The Becklyn RAD Bundle provides RAD related functionality for the usage in Symfony.

Installation

  1. First install the bundle via composer:

    composer require becklyn/rad-bundle
  2. Load the bundle in your bundles.php.

Models

DoctrineModel

The DoctrineModel bundles generic functionality for regular models. Each model should only be responsible for exactly one entity (although there can be multiple models for the same entity).

It mainly adds simple interactions with Doctrine, to get the repository and entity manager of the entity.

The entity class name that is related to this model is automatically guessed on the namespace + class name of your model. If this guessing fails, you can just override getFullEntityName() and return the FQCN.

The DoctrineModel also provides simple helper functions for persistence:

  • addEntity($entity) — persists the entity
  • removeEntity(...$entities) — removes the given entity
  • flush() — just flushes the entity manager

Entities

This bundle also provides several traits that easy the work with Doctrine entities.

Traits

IdTrait

Provides a generic ID with getter.

TimestampsTrait

Provides both timeCreated and timeModified fields.

You must initialize the created timestamp in the constructor yourself.

Helpers

PathHelper

A helper, that helps when working with paths.

  • join() – joins multiple paths