New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with A2lix and Generator Bundle #188
Comments
Well, take a look at my configs: "require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.7@beta",
"symfony2admingenerator/generator-bundle": "dev-master",
"symfony2admingenerator/form-extensions-bundle": "dev-master",
"symfony2admingenerator/user-bundle": "dev-master",
"friendsofsymfony/user-bundle": "~2.0@dev",
"a2lix/translation-form-bundle": "1.*@dev"
} a2lix_translation_form:
locales: [ru,en]
default_required: true
manager_registry: doctrine
templating: "A2lixTranslationFormBundle::default.html.twig" generator: admingenerator.generator.doctrine
params:
model: AppBundle\Entity\NewsItem
concurrency_lock: ~
bundle_name: AppBundle
pk_requirement: \d+
actionAfterSave: show
i18n_catalog: messages
custom_blocks: AppBundle:Form:custom_blocks.html.twig
fields:
content:
label: news.item.content
customView: nl2br
addFormOptions:
required: true
published:
label: news.item.published
publishedAt:
label: news.item.publishedAt
dbType: datetime
formType: s2a_datetime_picker
addFormOptions:
required: false
publishedBy:
label: news.item.publishedBy
category:
label: news.item.category
sortOn: category.title
addFormOptions:
query_builder: function (\Doctrine\ORM\EntityRepository $repository) { return $repository->createQueryBuilder("c")->orderBy("c.title", "ASC"); }
required: true
title:
label: global.title
addFormOptions:
required: true
translations:
label: global.translations
formType: a2lix_translations_gedmo
addFormOptions:
fields:
title:
label: global.title
object_actions:
delete:
credentials: 'hasRole("ROLE_NEWS")'
batch_actions:
delete:
credentials: 'hasRole("ROLE_NEWS")'
builders:
list:
params:
fields:
published:
label: ?
title: news.item.list.title
sort: [publishedAt, desc]
display:
- publishedAt
- title
- category
- published
actions:
new:
credentials: 'hasRole("ROLE_NEWS")'
object_actions:
show: ~
edit:
credentials: 'hasRole("ROLE_NEWS")'
excel:
params:
credentials: 'hasRole("ROLE_SUPER_PUPER")'
filename: ~
filetype: ~
new:
params:
credentials: 'hasRole("ROLE_NEWS")'
title: news.item.new.title
display: [published, category, title, content]
actions:
save:
credentials: 'hasRole("ROLE_NEWS")'
list: ~
edit:
params:
credentials: 'hasRole("ROLE_NEWS")'
title: news.item.edit.title
display: [published, category, translations]
actions:
save:
credentials: 'hasRole("ROLE_NEWS")'
delete:
credentials: 'hasRole("ROLE_NEWS")'
list: ~
show:
params:
title: "%title%|{ %title%: NewsItem.title }|"
display:
- category
- content
- published
actions:
list: ~
edit:
credentials: 'hasRole("ROLE_NEWS")'
actions:
params:
object_actions:
delete:
credentials: 'hasRole("ROLE_NEWS")'
batch_actions:
delete:
credentials: 'hasRole("ROLE_SUPER_PUPER")' |
Hi ksn135, thank you :) With your config, :
Whate Strategie use you and what version ? thank you |
My new config :
And always
|
@ksn135 Thank you |
Your entities are just fine. Just guessing:
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
// ...
);
stof_doctrine_extensions:
default_locale: "%locale%"
translation_fallback: true
persist_default_translation: true
class:
sluggable: AppBundle\Listener\SluggableListener
orm:
default:
timestampable: true
sortable: true
blameable: true
sluggable: true
tree: true
softdeleteable: true
translatable: true ############ <= ENABLE THIS !!!
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
options:
1002: "SET NAMES 'UTF8' COLLATE 'utf8_general_ci'"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
entity_managers:
default:
dql:
string_functions:
ifnull: DoctrineExtensions\Query\Mysql\IfNull
datetime_functions:
date: Luxifer\DQL\Datetime\Date
year: Luxifer\DQL\Datetime\Year
month: Luxifer\DQL\Datetime\Month
auto_mapping: true
mappings:
gedmo_tree:
type: annotation
prefix: Gedmo\Tree\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
alias: GedmoTree # this one is optional and will default to the name set for the mapping
is_bundle: false
##########################################################################
gedmo_translatable: ######## <= CHECK THIS BLOCK !!!!
type: annotation
prefix: Gedmo\Translatable\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
alias: GedmoTranslatable # this one is optional and will default to the name set for the mapping
is_bundle: false
gedmo_translator: ######## <= AND THIS ONE !!!!
type: annotation
prefix: Gedmo\Translator\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity"
alias: GedmoTranslator # this one is optional and will default to the name set for the mapping
is_bundle: false
##########################################################################
gedmo_loggable:
type: annotation
prefix: Gedmo\Loggable\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
alias: GedmoLoggable # this one is optional and will default to the name set for the mapping
is_bundle: false
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
# app/config/doctrine-extensions.yml
# services to handle doctrine extensions
# import it in config.yml
services:
##############################################################################
# KernelRequest listener
extension.listener:
class: AppBundle\Listener\DoctrineExtensionListener
calls:
- [ setContainer, [ @service_container ] ]
tags:
# translatable sets locale after router processing
- { name: kernel.event_listener, event: kernel.request, method: onLateKernelRequest, priority: -10 }
# loggable hooks user username if one is in security context
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
# Doctrine Extension listeners to handle behaviors
gedmo.listener.translatable:
class: Gedmo\Translatable\TranslatableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
- [ setDefaultLocale, [ %locale% ] ]
# - [ setTranslatableLocale, [ %locale% ] ]
- [ setTranslationFallback, [ true ] ]
##############################################################################
#### the rest are not important, you can remove them
gedmo.listener.tree:
class: Gedmo\Tree\TreeListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
gedmo.listener.timestampable:
class: Gedmo\Timestampable\TimestampableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
gedmo.listener.sluggable:
class: Gedmo\Sluggable\SluggableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
gedmo.listener.sortable:
class: Gedmo\Sortable\SortableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
gedmo.listener.loggable:
class: Gedmo\Loggable\LoggableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
|
Also, I strongly advise you to read this |
And yes, my entities is here |
@ksn135 Thank You, Now i have /admin/new
and /admin/ (list) I always clear my cache... |
Well, try to add new function to your class class Admin {
/*...*/
public function getTranslationEntityClass() { return "Ip\AdminBundle\Entity\AdminTranslation"; }
} Let's see what's happens next ) BTW: I'm absolutely sure that you are using a wrong version of Gdemo or A2lix bundle. |
it works! a big thank you |
Hi everybody,
I have an issue with A2lx when its pluged with Generator Bundle.
I'm using Symfony 2.7.1.
I searched the solution long time and i didn't find an answer.
The A2lix's repository has nothing on it and it seems it take long time to have an answer to...
So i come to you, and hope that someone have a solution to well configure this two bundle to work together.
Her is the config.yml :
Here is the entity Admin.php (there is the field 'fonction' i want to translate) :
Here is the class AdminTranslation :
And the Admin-generator.yml :
If someone could help me...
thanks a lot !
The text was updated successfully, but these errors were encountered: