This bundle provides integration for DoctrineExtensions in your Symfony Project.
For documentation, see it online
License: MIT
Integration bundle for DoctrineExtensions by l3pp4rd in Symfony
Home Page: https://symfony.com/bundles/StofDoctrineExtensionsBundle/current/index.html
License: MIT License
This bundle provides integration for DoctrineExtensions in your Symfony Project.
For documentation, see it online
License: MIT
Hi guys,
I have a problem with the translatable extension and here is the code to test it: https://gist.github.com/1278099
This test fails at the line 37 with this error:
- Hart\DssCoreBundle\Tests\Repository\PoiRepositoryTest::testLocaleNameNotNull
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-Valley
Which means that $valleyToTest->getName() return an empty string. It seems that same value in different languages are not stored in the db.
I'm using Symfony 2.0.4 and DoctrineExtensionsBundle 1.0.0
Hello,
I get this error :
Uncaught exception 'InvalidArgumentException' with message 'The parameter "session.default_locale" must be defined.' in /var/www/myproject/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:77
It seems to be related to this commit : symfony/symfony@ce4a8de
Hye,
The old issue was close so i am sorry but i create a new issue
I have error with doctrine:mongodb:generate:documents and the last symfony version
Z:\site\symfony-v2>php app/console doctrine:mongodb:generate:documents MongoMenuBundle
[Doctrine\ODM\MongoDB\MongoDBException]
No identifier/primary key specified for Document 'Stof\DoctrineExtensionsBundle\Document\LogEntry'. Every Document must have an identifier/primary key.
doctrine:mongodb:generate:documents [--document[="..."]] bundle
The error appear juste when StofDoctrineExtensionsBundle is true in the config.yml
Is there a recommended way to use this bundle with the current stable version of symfony? I've upgraded to the newest version, which results in Call to undefined method Symfony\Component\HttpFoundation\Request::getLocale()
as this is apparently only available in the HEAD of the symfony master branch.
Hi,
i get the following exception:
[Semantical Error] Annotation class "Gedmo\Tree\Mapping\Timestampable" does not exist. 500 Internal Server Error - AnnotationException
my config looks like
# Doctrine Configuration doctrine: dbal: default_connection: default connections: default: driver: %database_driver% host: %database_host% dbname: %database_name% user: %database_user% password: %database_password% orm: auto_generate_proxy_classes: %kernel.debug% default_entity_manager: default entity_managers: default: mappings: StofDoctrineExtensionsBundle: ~ stof_doctrine_extensions: default_locale: de_AT orm: default: ~
my model like:
/** * @orm:Entity * @orm:Table(name="user") */ class User { /** * @orm:Id * @orm:Column(type="integer") * @orm:GeneratedValue(strategy="AUTO") */ private $id; /** @orm:Column(type="string", length=64) */ private $username; /** @orm:Column(type="string", length=64) */ private $password; /** * @orm:Column(type="date") * @gedmo:Timestampable(on="create") */ private $created; /** * @orm:Column(type="datetime") * @gedmo:Timestampable(on="update") */ private $updated; public function setUsername($value) { $this->username = $value; } public function setPassword($value) { $this->password = $value; } }
I'm using the master branch of DoctrineExtensionBundle, DoctrineExtensions and Doctrine. Is there something wrong with the Annotations in my model, or why should it be mapped to Gedmo\Tree\Mapping\Timestampable and not to Gedmo\Timestampable\Timestampable?
Thank you a lot...
Hello,
I'm using this SF2 - PR12 and got an exception using the command line doctrine:generate:entities.
I use annotations, so what i did was create the protected $id and is annotations. After generate it i have to remove to be able to update the schema.
This is the exception without the "protected $id" created:
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\LogEntry'. Every Entity must have an identifier/primary key.
Thanks,
Daniel Gomes
in your documentation you use:
git submodule add git://github.com/l3pp4rd/DoctrineExtensions.git vendor/doctrine-extensions
Don't you think, that it would be better to name it:
git submodule add git://github.com/l3pp4rd/DoctrineExtensions.git vendor/gedmo-doctrine-extensions
Since it can be any number of extensions there, it would be better to add vendor prefix, to avoid mixing it.
Thanks for the awesome bundle, but the Sortable behavior doesn't appear to be included. Am I missing something or is this a feature to be added?
I am getting this exception when trying to install DoctrineExtensionsBundle with security and FOS_UserBundle enabled:
LogicException: Circular reference detected for service "doctrine.odm.mongodb.default_document_manager" (services currently loading: doctrine.odm.mongodb.document_manager, doctrine.odm.mongodb.default_document_manager, doctrine.odm.mongodb.event_manager, stof_doctrine_extensions.odm.mongodb.listener.loggable, security.context, security.authentication.manager, fos_user.user_manager)
Not sure how this should be resolved. So far I have removed security context dependency from DoctrineExtensionsBundle.
I am used symfony 2.04.
file StofDoctrineExtensionsBundle / Listener / TranslationListener.php
Fatal error: Call to undefined method Symfony\Component\HttpFoundation\Request::getLocale() in /www/mysite/vendor/bundles/Stof/DoctrineExtensionsBundle/Listener/TranslationListener.php on line 38
fixing problem!
Hi,
I try to use your Sluggable behavior of your Bundle but when I run the command line "doctrine:generate:entities" of Symfony2, I got this exception :
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\LogEntry'. Every Entity must have an identifier/primary key.
I'm wondering why it tries to generate Entities for LogEntry, I've specified my Bundle and I only use the sluggable behavior (I've disabled all other behaviors in my configuration file).
stof_doctrine_extensions:
orm:
default:
sluggable: true
loggable: false
tree: false
timestampable: false
translatable: false
The Entity where I use the Sluggable behavior is like this :
/**
MyVendorName\SiteBundle\Entity\Product
*
@Orm:Table()
@Orm:Entity
/
class Product
{
/*
/**
/**
/**
/**
All of the doctrine submodule (Orm, Dbal, Common) are switched to master branch. I got an other error if not (an inheritance problem already reported).
Have you any idea ?
Fabien
Is it possible to integrate the translatable fields in SonataAdminBundle?
It seems this function doesn't return the good hirarchy when multiple elements are set.
I set up :
--+Root
-------+Level1
------------+Sub level1
------------+Sub level2
And i have
--+Root
-------+Sub level2
-------+Level1
------------+Sub level1
I use this function to render my Tree
Thanks
I was trying to use the closure strategy for the tree extension and after updating my entities, I wasn't able to generate the schema.
[ErrorException]
Notice: Undefined variable: className in /var/www/Symfony/vendor/doctrine/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php line 343
Interestingly, the same error message displayed when I tried to login in my as well. But it went away when I changed my config.yml from
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
tree: true
to
stof_doctrine_extensions:
default_locale: en_US
orm:
default: ~
#tree: true
Any idea as to what is causing this error?
How do I clear the translation cache? I deleted the contents of app/cache, but I'm still getting out-of-date information from my queries. I don't have an opcode cache and I'm not using Doctrine's query or result caches. What should I do to clear the translation cache?
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %database_driver%
host: %database_host%
orm:
auto_generate_proxy_classes: %kernel.debug%
entity_managers:
read:
mappings:
StofDoctrineExtensionsBundle: ~
FooTerritorialBundle: ~
write:
mappings:
StofDoctrineExtensionsBundle: ~
FooTerritorialBundle: ~
stof_doctrine_extensions:
orm:
read: ~
write: ~
Validation trying get doctrine.dbal.read_connection
but as you see I'm setted up default
as default_connection
.
I found that doctrine is looking for complete id field.
It exist, but didn't have generator strategy="AUTO". Because of this issue, doctrine didn't understand that id is a primary field.
I placed:
id name="id" column="id" type="integer"
generator strategy="AUTO" /
/id
into files:
/vendor/bundles/Stof/DoctrineExtensionsBundle/Resources/config/doctrine/LogEntry.orm.xml
/vendor/bundles/Stof/DoctrineExtensionsBundle/Resources/config/doctrine/Translation.orm.xml
The complete file context for Translation is:
<entity name="Stof\DoctrineExtensionsBundle\Entity\LogEntry" table="ext_log_entries" repository-class="Gedmo\Loggable\Entity\Repository\LogEntryRepository">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
<indexes>
<index columns="object_class" name="log_class_lookup_idx" />
<index columns="logged_at" name="log_date_lookup_idx" />
<index columns="username" name="log_user_lookup_idx" />
</indexes>
</entity>
Doctrine\ORM\Mapping\MappingException was gone away and command doctrine:generate:entities executes normal.
Am I right going this way? Thanks for an answer.
P.S. Sorry for my English. I'm Russian.
When I run app/console doctrine:mongodb:generate:documents it fails with
Catchable Fatal Error: Argument 1 passed to Doctrine\ODM\MongoDB\Event\LoadClassMetadataEventArgs::__construct() must be an instance of Doctrine\ODM\MongoDB\Mapping\ClassMetadata, instance of Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo given, called in \vendor\doctrine-mongodb-odm\lib\Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory.php on line 273 and defined in \vendor\doctrine-mongodb-odm\lib\Doctrine\ODM\MongoDB\Event\LoadClassMetadataEventArgs.php line 41
In order to get it to work, I need to comment out mongodb settings of stof_doctrine_extensions in config.yml
The firewall is now called before the router. If it uses Doctrine, it creates the TranslatableListener before updating the session. This means that the locale used by the listener is not updated for the first request changing the locale through the url.
Hello. I've used Symfony2(Beta2) and when i try to create schema i get such error:
[ReflectionException]
Class Stof\DoctrineExtensionsBundle\Entity\Stof\DoctrineExtensionsBundle\Entity\AbstractTranslation does not exist
I've tried to find out the reason and it seems the reason is in names of entities xml files.
because in class XmlDriver
in method getAllClassNames
get next code $classes[] = $prefix.''.str_replace('.', '', $fileName); - here we get double namespace.
I'm not sure if it's a bug.
The core.request listener don't seems to be executed when in test environment.
So when created my database with data fixtures the entity-manager's event manager hasn't any listeners, i have to attach listeners manually when loading data fixtures.
Is it normal ? thank you
When the extension config (yml) looks like this:
stof_doctrine_extensions: orm: default: translatable: false timestampable: true sluggable: false tree: false loggable: false
I would expect that the services and entity mapping for 'translatable', 'sluggable'. 'tree' and 'loggable' wouldn't be loaded.
Btw Good job on the Extension
I have a little pb to get working Sluggable Extensions :)
Here is my gist
https://gist.github.com/105559a6f2c5dda96c81
I dont understand why sluggable does not take care of my name .
Thanks a lot :)
Hey Stof-
I think we should add a note about un-mapping the bundle's entities, unless you want the Log or Translation entities. Basically, show auto_mapping
can be true
, but how the bundle's mapping can be turned off in the default entity manager. I use your bundle all the time - but usually just for Sluggable and Timestampable, so I do this commonly.
Thanks!
I receive always the error message
[Semantical Error] The annotation "@gedmo\Mapping\Annotation\Translatable" in property ... does not exist, or could not be auto-loaded.
I use Symfony 2.0.4 and the StofDoctrineExtensionsBundle
How could I fix this error?
In the documentation there is written, that only Doctrine2.1.x is working with this bundle. How could I ensure that I use the correct version?
Hello,
I just installed DoctrineExtensionsBundle and I have an error. While using Timestampable behaviour, i can't generate entities :
$ php app/console doctrine:generate:entities Site/IfgmgenBundle/Entity/Object
Generating entity "Site\IfgmgenBundle\Entity\Object"
PHP Fatal error: Doctrine\Common\ClassLoader::loadClass(): Failed opening required '/home/XXX/ifgmgen/app/../vendor/gedmo-doctrine-extensions/lib/Gedmo/Timestampable.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/XXX/ifgmgen/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php on line 148
Fatal error: Doctrine\Common\ClassLoader::loadClass(): Failed opening required '/XXX/ifgmgen/app/../vendor/gedmo-doctrine-extensions/lib/Gedmo/Timestampable.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/XXX/ifgmgen/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php on line 148
The Timestampable.php file is in a Timestampable folder, wich Doctrine doesn't seems to look into...
Why do I look to be the only one with that problem ? What must I do to solve it ?
Thank you for your great work
The extensions allow to use a custom slug generator but this is not supported in the bundle configuration yet.
Since I'm not currently using Translatable or Loggable, I've disabled the mappings for the bundle shown:
orm:
auto_mapping: true
mappings:
StofDoctrineExtensionsBundle: false
However, when using the Tree (closure) behavior I get an error:
No identifier/primary key specified for Entity 'Test\TestBundle\Entity\NodeClosure'. Every Entity must have an identifier/primary key.
If I turn the mappings back on (StofDoctrineExtensionsBundle: ~
) then it seems to work. The problem with having the mappings turned on is that Doctrine then creates those translation and log tables in the database which I don't want.
Is this a bug?
A related question:
Let's say I just want the Loggable behavior but not the Translatable behavior (or vice versa), is there a way to configure the bundle so that it only creates the database tables that are actually needed and not all tables?
File: SluggableListener
Function: makeUniqueSlug()
Line: $result += $this->getSimilarPersistedSlugs($config['useObjectClass'], $preferedSlug, $config['slug']);
+= operator:
Merges only unique keys. So it happens that ignores Persisted slugs if there are Similar slugs fetched from DB.
beta1 to beta2
Doctrine event subscribers now use a unique "doctrine.event_subscriber" tag. Doctrine event listeners also use a unique "doctrine.event_listener" tag. To specify a connection, use the optional "connection" attribute.
All translation datas are saved in the default translation entity : ext_translations.
I set my default locale for the bundle to en. When I persist a translatable entity, I get an entry in the entity table as well as entries in the translation table for the en_us locale. I'm not saving any translations for en_us in my code, so I'm not sure where they're coming from. I want to save an entity for the default locale with no translations. What should I do?
Hi,
while I try to run doctrine:generate:entities I got the following error:
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\Translation'. Every Entity must have an identifier/primary key.
After looking for this problem I found the following topic in the forum:
http://forum.symfony-project.org/viewtopic.php?f=23&t=32065&p=111026&hilit=primary+key#p111088
So it may be useful to update your entities to use protected attributes.
No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\LogEntry'. Every Entity must have an identifier/primary key.
There is an error whith custom translation entity when i launch doctrine:generate:entities
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Allblacks\MyBundle\Entity\MyTranslationEntity'. Every Entity must have an identifier/primary key.
If I had to guess, I'd suggest this is due to the current state of flux with Doctrine and Symfony lately but I've tried to track it down for much of today without success. Figured I'd drop you an issue in case it rings any bells for you.
I'm getting the following warning when I run "app/console doctrine:schema:create"
Warning: class_parents(): Class Stof\DoctrineExtensionsBundle\Entity\Stof\DoctrineExtensionsBundle\Entity\AbstractClosure does not exist and could not be loaded in /home/pdugas/work/vendor/doctrine/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php line 223
I'm working from the 2.0BETA2 version of Symfony Standard using the included bin/vendors.php script. I've tried changing the VERSION to 2.0.0NEXT and changing the bin/2.0.0NEXT.deps file to use "master" instead of "2.0.5" for the doctrine version. I've also tried making sure I've got "master" versions of DoctrineExtensionsBundle and gedmo-doctrine-extensions. Just can't seem to shake this fault.
When I try to load the Bundle with bin/vendors, I am getting the error message
Cloning into /myprojectvendor/bundles/Stof/DoctrineExtensionsBundle...
fatal: http://github.com/stof/StofDoctrineExtensionsBundle.git /info/refs not found: did you run git update-server-info on the server?
The entry in the deps file is
[DoctrineExtensionBundle]
git=http://github.com/stof/StofDoctrineExtensionsBundle.git
target=bundles/Stof/DoctrineExtensionsBundle
[gedmo-doctrine-extensions]
git=http://github.com/l3pp4rd/DoctrineExtensions.git
The sequence of the two entries doess not play a role, the entry under gedmo-doctine-extensions works.
Hey Stof,
I'm trying to override the default Listener for my own. Changing it directly in the XML works, but overriding in config.yml does not work. Here is my code. which is directly from your documentation with obvious changes to the class name.
stof_doctrine_extensions:
class:
orm:
translatable: MRX\Common\MrxCoreBundle\ORM\TranslationListener
I guess I can just fork your code, but this should be easy to override.
Thanks,
Justin Fortier
Hello,
We face a problem since we switched to RC4: the PHP error "max memory allowed" now occurs. Depending on the configuration, other errors appear: with xdebug, "max level of recursion" (or something of that kind); with xdebug and xdebug.max_nesting_level=0 in php.ini, the one I described earlier; without xdebug, Apache just keeps crashing...
I'm using the latest version of StofDoctrineExtensionsBundle and the deps.lock from RC4 Standard Edition.
With the newest repository version i got such error.
Fatal error: Call to undefined method Symfony\Component\HttpFoundation\Request::getLocale() in C:\projects\civittabase\vendor\bundles\Stof\DoctrineExtensionsBundle\Listener\TranslationListener.php on line 38
If i revert this file to earlier, everything works fine.
I am trying to implement file upload behavior based on cookbook
http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html
Just an idea - it would be nice if somebody could integrate that code into extension.
Something like
/** * @Gedmo\Upload * @ORM\Column(name="screenshot",fileUploadField="screenshotFile") */ protected $screenshot;
fileUploadField - optional
By default, this extension should add public property screenshotFile to entity, and prePersist function in order to upload that file into needed location and set primary field with file name.
I dont have enough knowledges yet to do it myself :)
I've installed the Bundle following the instructions and I can't use the doctrine:generate:entities command as the following error appears:
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\LogEntry'. Every Entity must have an identifier/primary key.
The onCoreRequest() event doesn't fire when running the CLI so records created by Loggable end up with null username values. It's not a big deal to me. Just thought I'd add it to the queue in case it becomes an issue for someone else.
Hi guys, I just started to work with this bundle, my problem is, that this 'ext_log_entries' table always generated. I just dont need it, can I disable the generation of it & 'ext_translations'?
If I do the
mappings:
StofDoctrineExtensionsBundle: false
settings, it wont generate, of course, but then I am not able to use the independent translation tables extended from 'AbstractTranslation'
Any ideas would be appreciated.
Hi,
I'm using symfony2 beta1 with doctrine 2.0.5, and I have the following error :
Fatal error: Call to undefined method Stof\DoctrineExtensionsBundle\Listener\LoggableListener::setAnnotationReader()
Thanks !
app/console doctrine:schema:update --dump-sql
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Orm\Entity" in class Stof\DoctrineExtensionsBundle\Entity\AbstractLogEntry was never imported.
These errors are happening to the current symfony-standard release (fresh install). I fixed it by adding the Doctrine ORM namespace to the above class, but I'm thinking that's the wrong place.
Hi Stof,
Having a bit of a problem, not sure if it's to with this extension, or doctrine2. I'm bringing it up to you, so you can elevate it if need be. Basically here's the scenario:
After creating the doctrine metadata yaml files, I set my repository class to "Gedmo\Translatable\Repository\TranslationRepository" and leave fields as blank. I then try and run "app/console doctrine:generate:entities MyBundle". This brings up an error saying I need to define at least one index. Creating a field named "idx" in the yaml solves the issue (if I use 'id' symfony yells at me for being a duplicate field).
In order to get this whole thing to work with doctrine:schema:update, I need to create the idx field in yaml, generate the entities. Then remove the field from the database, and the entity, and then set "id" to be auto increment. Not sure why but this doesn't seem to be set for some reason.
Thanks for the great bundle! I realize I'm not implementing this via annotations and that could be the problem, but I believe it shouldn't matter between yaml, xml, annotations they should all work. However my company has already decided to make yaml's our standard for Symfony2 because they're much more condensed. So I would really love to avoid mixing yaml, and annotation configurations.
Other wise it does work, so thank you for all your hard work! Please let me know if you need to see my code.
Thanks for your time,
Justin Fortier
Not sure if this is a bug, but I'm getting an error when I try to generate entities:
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\Translation'. Every Entity must have an identifier/primary key.
This error happens even when I disable the Translatable service in my config.yml:
stof_doctrine_extensions:
orm:
default:
translatable: false
timestampable: true
I had problems recently with
Call to undefined method Symfony\Component\HttpFoundation\Request::getLocale()
But, before switching I tried to deactivate translatable behavior by adding code
stof_doctrine_extensions: default_locale: ru_RU orm: default: tree: false sluggable: false translatable: false timestampable: false loggable: false
And still got the same error - so actuall listener was called somewhere.
Looks like a bug - isn't it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.