doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.77k stars 224 forks source link

Use QuoteStrategy from Configuration to get table names #192

Closed plfort closed 9 years ago

plfort commented 9 years ago

Use QuoteStrategy to get table names See #191

plfort commented 9 years ago

I didn't test on 2.4.* ... I will fix it

alexsegura commented 9 years ago

@plfort wow your PR is way better than mine https://github.com/doctrine/data-fixtures/pull/204

Did you manage to fix the tests?

fon60 commented 9 years ago

I think there was some error on travis, because only PHP5.3 failed. So this must have been some kind of glitch or error in Anotations regarding this version of PHP or uncleared cache. Can someone rerun tests on travis?

alexsegura commented 9 years ago

@fon60 actually it failed with PHP 5.3 & doctrine-orm 2.4.7, look at the output of Composer in Travis

This is because doctrine-orm 2.5.* needs at least PHP 5.4, while doctrine-orm 2.4.7 works with PHP 5.3

alexsegura commented 9 years ago

@plfort the Travis build completed successfully, great :smile:

@lavoiesl do you think we can merge this PR ?

edigu commented 9 years ago

+1 on this.

I hit the same problem today, ORMPurger ignores schema name on postgresql and produces wrong delete query before running fixtures.

My entity:

<?php
namespace Core\Entity;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="users", schema="core")
 */
class User
{
}

and output of the data-fixture:import command is:

[Doctrine\DBAL\Exception\TableNotFoundException]                             
  An exception occurred while executing 'DELETE FROM users':                   
  SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "users" does not exist  
alexsegura commented 9 years ago

@edigu did you try with this branch?

edigu commented 9 years ago

Yes. I just tried now with dev-master#7c4d7c and my fixtures are loaded without any problems even with --purge-with-truncate argument. So i can confirm that ORMPurger properly generates the delete query with this PR. @plfort thanks for your effort.

fon60 commented 9 years ago

So now what? I'm waiting for this PR very much.

alexsegura commented 9 years ago

Not sure who are the maintainers of this project

guilhermeblanco commented 9 years ago

:+1:

FractalizeR commented 8 years ago

Will this make into 1.x?

fon60 commented 8 years ago

I'm also waiting for release with this fix.

FractalizeR commented 8 years ago

For now I'm just doing all manually with --append ;)

awildeep commented 8 years ago

I am still having issues with this. Can anyone send me a working example of a composer.json using symfony3?

No matter what I try I can't get the fixtures to detect my schema names for my entities. It detects my schema names on my ManyToMany join tables, but not my actual entities.

awildeep commented 8 years ago

So I found my issue, but this took way longer to resolve than I expected:

my composer.json had: "doctrine/doctrine-fixtures-bundle": "^2.3"

But did not contain a reference to "doctrine/data-fixtures". As such I was grabbing v1.1.1 of "doctrine/data-fixtures", which is the latest stable release however it does NOT include this correction.

Anyone care to comment on when we might be getting an updated stable release?

To correct my problem I had to add this to my composer.json: "doctrine/data-fixtures": "dev-master"