Skip to content

propel:form:generate fails for separated scheme #173

Closed
smirik opened this Issue Aug 12, 2012 · 8 comments

10 participants

@smirik
smirik commented Aug 12, 2012

Hello,

Environment: symfony 2.1 RC1, FOSUserBundle, propel.

I've created table "profiles" with foreign key user_id related to fos_user table (one-to-one). But when I tried command php app/console propel:form:generate @ThisIsBundle Profile I got the following error:

[BuildException]                                                         
Table "profiles" contains a foreign key to nonexistent table "fos_user"

I copied the data from FOSUserBundle's schema.xml to the new one and everything was fine after that.
Seems the issue is that in FormGenerateCommand.php at line 55 propel gets info from only one bundle:

if ($schemas = $this->getSchemasFromBundle($this->bundle)) {

One of the possible solutions is to get all schema.xml files from all bundles and combine them.

Thank you!

@maxailloud

I have the same problem but directly with the php app/console propel:build command.

Is there a way to link a custom table in a bundle to the fos_user table?
It could be useful, I don't want to override all the FosUserBundle's schema and need to update myself when FosUserBundle will be update.

@superhaggis

Same problem here. Trying to generate a form for a model that doesn't even have any associations with "fos_user".

[BuildException]
Table "user_profile" contains a foreign key to nonexistent table "fos_user"

I guess my quickest fix is the same as @smirik - copying the schema across.

@carlwitt

Exactly. In Table.php / setupReferrers is called with throwErrors = true. (line 882)

The call to
$foreignTable = $this->getDatabase()->getTable($foreignKey->getForeignTableName());
erroneously fails as the database contains only the tables of the current subschema.

@alanbem
alanbem commented Dec 17, 2012

Same problem here :(

@lukaszblacha

Any progress here?

@linde002

I'm having the exact same issue. Is there any progress or a resolution?

@chris087

Same problem here..

@morozow
morozow commented Sep 21, 2015

Sep, 2015... Problem has not solved yet.

@havvg havvg added this to the 1.5 - Symfony 2.8 LTS support milestone Jan 22, 2016
@havvg havvg added the Bug label Jan 23, 2016
@havvg havvg added a commit to havvg/PropelBundle that referenced this issue Jan 23, 2016
@havvg havvg combine schema files into one AppData
This fixes #173.

In case the schema.xml files are referenced across multiple bundles, the \AppData needs to be extended by each bundle, before reading data from the respective \Database.
da1f027
@havvg havvg closed this Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.