Big table names in doctrine2 - doctrine-orm

I have this "new" table in my database: event_comment_oauth_service which is an many-to-many relation table, between event_comment, and oauth_service.
I ran these commands to update my symfony2 entities:
php app/console doctrine:mapping:import testSiteBundle yml
php app/console doctrine:generate:entities test --path=src/
all tables are generated OK, but not the new one.
How can I generate the new table?

Doctrine2 does not act the same way as Doctrine1 for the many to many tables. If you want to have an entity, you have to create it and add one to many/many to one associations by yourself.

Related

Doctrine ORM custom persist / get entities

I have an existing database made and currently used by a Drupal project. I need to write an app using Doctrine and this database.
I'd like to use the Doctrine ORM, but I cannot change the Database schema and it is kind of unintuitive (Drupal has kind of one table per data to store...).
Is there a way to tell Doctrine the SQL to store and read every attribute of my entities ?
Otherwise I will use Doctrine DBAL, but the simplicity of the entities interests me a lot.

Doctrine 2 Orm ManyToOne with unsigned foreign keys

I'm using Symfony3 with Doctrine ORM 2 Annotations.
I generated entities from an existing MySQL database. I also wrote all the relations.
Before updating the Database I schema I used the command
php app/console doctrine:schema:update --dump-sql
I have all the primary keys with INT unsigned so the related foreign keys too.
Now I noted that Doctrine ORM doesn't allow to use the
options={"unsigned":true}
in
#JoinColumn
So how can I solve this issue ?
Do I have to let Doctrine rewrite all the keys ?
I dont' know what way to follow to avoid damage to the DB and data.

Generate Single Entity In Doctrine2 With ZF2

Hi I've the following commands to generate annotation and entities of mysql database tables in doctrine2 with zend framework 2
Generate annotations with doctrine
vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Application\\Entity\\" --force --from-database annotation ./module/Application/src/
Generate entities with doctrine
vendor/doctrine/doctrine-module/bin/doctrine-module orm:generate-entities ./module/Application/src/ --generate-annotations=true
But I'm really not getting that how to generate a single entity with annotations of new created table in database.
Thanks.
I've did it with the following -filter option as suggested by blackbishop
Generate annotations with doctrine For Single Table
vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Application\\Entity\\" --force --from-database --filter="link" annotation ./module/Application/src/
Generate entities with doctrine For Single Table
vendor/doctrine/doctrine-module/bin/doctrine-module orm:generate-entities ./module/Application/src/ --generate-annotations=true --filter="link"
Where link is my new created table name.
Thanks blackbishop

Create Doctrine entity of single table from database in Zend Framework 2

I have configured doctrine ORM in my ZF2 project and create doctrine entity of whole database. Now, I have added one more table named dashboard_group in database. How can I create Doctrine entity for only this table.
I don't want to replace other created entities.
Use –filter option in your command :
./vendor//bin/doctrine-module orm:convert-mapping --namespace="YourModule\\Entity\\" --force --from-database --filter="dashboard_group" annotation ./module/MonModule/src/
And then to add setter/getter into the generated entity :
./vendor/bin/doctrine-module orm:generate-entities ./module/YourModule/src/ --generate-annotations=true --filter="dashboard_group"

How to Use a Table Prefix in Doctrine2's NamingStrategy Interface?

I want to duplicate our existing table structure, and we use table prefixes for all columns:
table name:
TBLO_TABLE_ONE
table columns:
TBLO_COLUMN_ONE
TBLO_COLUMN_TWO
etc...
However, the Doctrine Interface for NamingStrategy does not seem to accommodate. any ideas?
I've submitted a pull request to Doctrine2 github repository, adding this functionality.
https://github.com/doctrine/doctrine2/pull/357