composer require zent/vars-bundle dev-master
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Zent\VarsBundle\ZentVarsBundle(),
// ...
);
}
// src/AppBundle/Entity/Vars.php
use Zent\VarsBundle\Entity\BaseVars;
class Vars extended BaseVars
{
}
# app/config/config.yml
zent_vars:
class: AppBunde\Entity\Vars
If you need additional caching:
doctrine_cache:
providers:
zent_vars_query_cache:
type: apc
namespace: query_cache_ns
alias:
- zent_vars.cache
Doc: https://symfony.com/doc/current/bundles/DoctrineCacheBundle/reference.html
$varsManager = $container->get('zent_vars.manager');
$var = $varsManager->getValue('first');
$var = $varsManager->getValue('first', 10); //return '10' if var not found
{{ vars('first') }}
php app/console zent:vars:create email_owner [email protected] "Email владельца"
php app/console zent:vars:update email_owner [email protected]
php app/console zent:vars:delete email_owner
php app/console zent:vars:list