Comments (12)
The sluggable listener is registered when using the bundle. The point here is adding a way to configure the transliterator used instead of always using the default one.
from stofdoctrineextensionsbundle.
you can always get the sluggable listener as service and change transliterator.
from stofdoctrineextensionsbundle.
@stof aah I see. I was getting an error, so I must not have been doing something right. Do you need to do something config-wise to get the listener to register with the bundle? I must be missing something.
from stofdoctrineextensionsbundle.
@stof. Looks like I didn't activate the extension for the orm entity manager. After searching and being stuck for a day, I'd say this is a common gotcha for new adopters. Do you mind if I put a small note about the exception you would get if you didn't configure correctly in the documentation? This would have saved me alot of time and future searches on the subject would be cleared up at the source. I'll submit the pull if that's cool.
from stofdoctrineextensionsbundle.
The bundle already handles setting the slug? I've searched thought the past issues, and I'm having the same problem as the issue #23 (Column 'slug' cannot be null). Any help? :) Thanks.
from stofdoctrineextensionsbundle.
@ruipenso please post a gist with your config.yml entry for stof_doctrine_extensions
, you're entity, and the place where you are persisting the entity.
from stofdoctrineextensionsbundle.
Hi @Merrix, my gist https://gist.github.com/1047590.
Thanks in advance.
from stofdoctrineextensionsbundle.
The problem is in annotations:
use Gedmo\Mapping\Annotation as Gedmo;
and when use same style for annotating your properties:
@Gedmo\Sluggable
or
@Gedmo\Slug(separator="-", unique=true)
The annotation mapping was not updated in blog, and docs since it is quite new implementation and users haven't migrated yet.
from stofdoctrineextensionsbundle.
Nice :) Thank you.
from stofdoctrineextensionsbundle.
I am trying to find a workaround for the bug in slug generation of DoctrineExtensions library (https://github.com/l3pp4rd/DoctrineExtensions/issues/27).
In the thread, @l3pp4rd said that changing the transliterator function could fix the bug by calling:
$sluggableListener->setTransliterator(array('Gedmo\Sluggable\Util\Urlizer', 'urlize'));
I tried to override the service and add a method call to setTransliterator
by declaring in my bundle config/services.xml
:
<service id="stof_doctrine_extensions.listener.sluggable" class="%stof_doctrine_extensions.listener.sluggable.class%" public="false">
<call method="setAnnotationReader">
<argument type="service" id="annotation_reader" />
</call>
<call method="setTransliterator">
<argument type="collection">
<argument>Gedmo\Sluggable\Util\Urlizer</argument>
<argument>urlize</argument>
</argument>
</call>
</service>
But it does not work because I get at first slug generation:
Integrity constraint violation: 1048 Column 'slug' cannot be null
Do you have any ideas ?
from stofdoctrineextensionsbundle.
if overriding does not work, you can extend sluggable listener with new class, and in constructor set the transliterator callable. I do not know how DIC prioritizes these services :) read stof docs how to set custom listener classes
from stofdoctrineextensionsbundle.
Thanks @l3pp4rd, this is working. Here is what it looks like for me now : https://gist.github.com/1170877
from stofdoctrineextensionsbundle.
Related Issues (20)
- 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
- [TimeStampable] symfony/clock use instead of new DateTime HOT 3
- Timestampable in new Symfony 7 Project throws error on migration HOT 3
- Missing typed arguments in function NestedTreeRepository::__call()
- Incompatible with symfony v7.0.3 HOT 11
- Timestampable not working when persisting data in database ( enable to set dateTime to createdAt & updatedAt ) HOT 1
- How can I use Gedmo Translatable and Gedmo Loggable together? HOT 2
- Deprecation: Using ArrayAccess on Doctrine\ORM\Mapping\FieldMapping HOT 1
- Inject the attribute reader in place of the annotations reader when able
- SoftDeleteableFilter 'addFilterConstraint' not compatible
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.