stormdelta / latex-encoder-annotation-bundle
Latex Encoder Annotation Bundle
Installs: 35
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-04-26 20:56:44 UTC
README
This bundle is still under development!
Use annotations to safely encode values to LaTeX. Installation
composer require stormdelta/latex-encoder-annotation-bundle
Configuration
Configure Bundle in app/AppKernel.php
//app/AppKernel.php
use ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
...
new StormDelta\LatexEncoder\AnnotationBundle\StormDeltaLatexEncoderAnnotationBundle(),
...
);
...
}
Usage
Use annotations in the entity
//src/AppBundle/Entity/LatexEntity.php
namespace AppBundle\Entity\LatexEntity;
use StormDelta\LatexEncoder\AnnotationBundle\Annotation\LatexEncoderAnnotation as LatexEncode;
class LatexEntity
{
/**
* @LatexEncode
*/
$variable;
}
Encode in the controller
//src/AppBundle/Controller/DefaultController.php
namespace AppBundle\Controller;
use ...
class DefaultController extends Controller
{
...
public function indexAction(...)
{
$entity = new LatexEntity();
...
$entity = $this->get('stormdelta.latexencoder.driver')->encode($entity);
...
return array('entity' => $entity);
}
}
"Advanced" Usage
Use LatexEncoderFollowAnnotation in the entity to encode related entities
//src/AppBundle/Entity/LatexEntity.php
namespace AppBundle\Entity\LatexEntity;
...
use StormDelta\LatexEncoder\AnnotationBundle\Annotation\LatexEncoderFollowAnnotation as LatexFollow;
class LatexEntity
{
/**
* @ORM\OneToMany(targetEntity="...")
* @LatexFollow
*/
$variables;
}