Comments (4)
First the namespace of the repository is wrong: it is now Gedmo\Translatable\Entity\Repository\TranslationRepository
.
Which version of Doctrine are you using ? The EntityGenerator did not handled the inheritance at the time of the 2.0.0 release (which produced exactly the error you get). This is now fixed but I don't remember if it was before the 2.0.1 release or after. It will work with 2.0.2 anyway (which will be released at the end of the month).
Using YAML for your own entities should work. The YAML mapping is described on the blog of the extension integrated by my bundle.
Btw most of the work is done by l3pp4rd which provides the extension. the bundle is easy comparing to the extension :)
Regards.
from stofdoctrineextensionsbundle.
I'm using Doctrine version 2.0.1-DEV
I'm trying to use your mapped super class, but I'm having some difficulties. Do you have any usage examples? I seem to be able to create object, and it puts the default locale into the i18n table. Once I grab the object, change the locale (verified that it does indeed change the locale), and save it it does not seem to saving the translation, or anything for that matter. Not sure what I'm doing wrong.
Here's how it's setup:
##### PERMISSIONS ##### MRX\Backend\AuthBundle\Entity\Permissions: type: entity table: permissions gedmo: translation: entity: MRX\Backend\AuthBundle\Entity\PermissionsI18n fields: id: id: true type: bigint nullable: false token: type: string length: 25 fixed: false nullable: false name: type: string length: 25 fixed: false nullable: false gedmo: - translatable description: type: string length: 255 fixed: false nullable: false gedmo: - translatable inheritable: type: boolean lifecycleCallbacks: { }
##### PERMISSSIONS I18N ##### MRX\Backend\AuthBundle\Entity\PermissionsI18n: type: entity table: permissions_i18n repositoryClass: Gedmo\Translatable\Entity\Repository\TranslationRepository indexes: translations_lookup_idx: columns: [locale, object_class, foreign_key] uniqueConstraints: lookup_unique_idx: columns: [locale, object_class, foreign_key, field] fields: #id: #id: true #type: bigint #nullable: true lifecycleCallbacks: { }
### CONTROLLER ### $this->getSession()->setLocale("fr_CA"); $perm = $em->find( 'MRX\Backend\AuthBundle\Entity\Permissions', 79 ); $perm->setName("Hamilton"); $perm->setAccess(1); $perm->setDescription("Ma description"); $perm->setGrant(1); $perm->setInheritable(0); $perm->setToken("HAM"); $perm->setEm($em); $perm->save(); //just does a persist and flush on the object.
Once again, your help is greatly appreciated!
from stofdoctrineextensionsbundle.
You need to add an unpersisted property in your entity to store the locale and map it for the extension. Look at the official blog to see the YAML mapping example.
from stofdoctrineextensionsbundle.
Ah, that's what I was missing! Thank you so much, it works perfectly now! I really have to stop working so much, I'm really starting to overlook important and simple things.
Can't wait for that doctrine problem to be gone, it's really making it a pain to use the super-mapped class.
from stofdoctrineextensionsbundle.
Related Issues (20)
- Generated Repository classes break after 1.5.0 update HOT 2
- Argument 1 passed to Gedmo\Mapping\MappedEventSubscriber::loadMetadataForObjectClass
- ext_translations table not generated HOT 1
- Support php 8.0 HOT 9
- php8 compatibility HOT 2
- Integrity constraint violation HOT 1
- PHP Fatal error: Uncaught Error: Class 'Doctrine\Bundle\DoctrineExtensionsBundle\DoctrineExtensionsBundle' not found in /home/mciat/Software/api-yelo.eco/src/Kernel.php:25 HOT 1
- Undefined constant Doctrine\DBAL\Types\Type::<Insert constant coin here> HOT 2
- SoftDeleted entities are not filtered/excluded from database results HOT 1
- loggable and doctrine migrations
- [SoftDeletable] How to disable on entity getter HOT 2
- Sort error when using Repository functions HOT 1
- Next release ? HOT 4
- doctrine.event_subscriber is deprecated HOT 3
- Timestampable logic no longer works on 1.8.0 HOT 6
- Listeners not working HOT 3
- UnexpectedValueException: tree metadata HOT 7
- Allow the bundle to work without the annotation reader HOT 3
- Support Symfony 7, Switch doctrine suubscribers to #[AsDoctrineListener] HOT 1
- Support Symfony 7 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stofdoctrineextensionsbundle.