Contributte Doctrine-extensions-atlantic18
# Content
Doctrine (Atlantic18/DoctrineExtensions (opens new window)) extension for Nette Framework
# Setup
First of all, install and configure nettrine/dbal (opens new window) and nettrine/orm (opens new window) packages`.
Install package
composer require nettrine/extensions-atlantic18
1
Register extension
extensions:
nettrine.extensions.atlantic18: Nettrine\Extensions\Atlantic18\DI\Atlantic18BehaviorExtension
1
2
2
# Configuration
Configure listeners. By default all listeners are disabled, enable only the required ones.
nettrine.extensions.atlantic18:
loggable: false
sluggable: false
softDeleteable: false
treeable: false
blameable: false
timestampable: false
translatable: false
uploadable: false
sortable: false
ipTraceable: false
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# Loggable, Translatable, Treeable
Setup extra entity mapping.
extensions:
orm.annotations: Nettrine\ORM\DI\OrmAnnotationsExtension
orm.annotations:
mapping:
# your app entities
App\Model\Database\Entity: %appDir%/Model/Database/Entity
# doctrine extensions entities
Gedmo\Translatable: %appDir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity
Gedmo\Loggable: %appDir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity
Gedmo\Tree: %appDir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity
...
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
If you are using nettrine/dbal
all listeners are registered automatically, otherwise you have to register them manually:
// Get EventManager, from DI or Entity Manager
$evm = $em->getEventManager();
// Register desired listener to event
$evm->addEventSubscriber($listener);
1
2
3
4
5
6
2
3
4
5
6
# Translatable (opens new window)
TranslatableListener has a complex configuration:
nettrine.extensions.atlantic18:
translatable:
translatable: cs_CZ
default: cs_CZ
translationFallback: false
persistDefaultTranslation: false
skipOnLoad: false
1
2
3
4
5
6
7
2
3
4
5
6
7
# IpTraceable (opens new window)
IpTraceable requires client IP address:
nettrine.extensions.atlantic18:
ipTraceable:
ipValue: @Nette\Http\IRequest::getRemoteAddress()
1
2
3
2
3