Skip to content
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

Cannot persist Comment or Post entities #34

Open
marcomarcomarco opened this issue May 14, 2014 · 1 comment
Open

Cannot persist Comment or Post entities #34

marcomarcomarco opened this issue May 14, 2014 · 1 comment

Comments

@marcomarcomarco
Copy link

Hi,

if i try to persist a post or comment entity,
i get this error from doctrine:
ContextErrorException: Notice: Undefined index: 000000000895bb6c00007ff6bd269d51 in /var/www/FlywersApi/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 2860

I think that this is because i cannot synchronize the db schema, indeed, running "php app/console doctrine:schema:update" i get:

[Doctrine\DBAL\DBALException]
An exception occurred while executing 'ALTER TABLE wp_postmeta ADD CONSTRAINT FK_41C0A2764B89032C FOREIGN KEY (post_id) REFERENCES wp_posts (ID)':

SQLSTATE[HY000]: General error: 1005 Can't create table 'flywers.#sql-4a3d_13adb' (errno: 150)

How could i solve this problem? i would just need to persist a new comment

@benglass
Copy link
Contributor

@marcomarcomarco you should disable doctrine orm auto mapping and instead create a separate entity manager for the wordpress bundle to use which only maps the wordpress bundle entities. This will prevent issues with doctrine:schema:update trying to modify wordpress tables

doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    MyNormalBundle: ~
                    AnotherBundle: ~
            wordpress:
                mappings:
                    KayueWordpressBundle: ~

kayue_wordpress:
    entity_manager: wordpress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants