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

keep bundle declaration order for multiple schemas #273

Open
rillsoft opened this issue Feb 22, 2014 · 5 comments
Open

keep bundle declaration order for multiple schemas #273

rillsoft opened this issue Feb 22, 2014 · 5 comments

Comments

@rillsoft
Copy link

@@ -206,12 +206,13 @@ abstract class AbstractCommand extends ContainerAwareCommand

         $base = ltrim(realpath($kernel->getRootDir().'/..'), DIRECTORY_SEPARATOR);

+        $pos = 0;
         $finalSchemas = $this->getFinalSchemas($kernel, $this->bundle);
         foreach ($finalSchemas as $schema) {
             list($bundle, $finalSchema) = $schema;
             $packagePrefix = $this->getPackagePrefix($bundle, $base);

-            $tempSchema = $bundle->getName().'-'.$finalSchema->getBaseName();
+            $tempSchema = ($pos++).'-'.$bundle->getName().'-'.$finalSchema->getBaseName();
             $this->tempSchemas[$tempSchema] = array(
                 'bundle'    => $bundle->getName(),
                 'basename'  => $finalSchema->getBaseName(),
@stood
Copy link

stood commented Feb 22, 2014

What is your problem? You have an error ?

@rillsoft
Copy link
Author

I have two bundle (CoreBundle, GuardBundle)
I want to GuardBundle-tables in create-script is defined in the first place.

@stood
Copy link

stood commented Feb 22, 2014

Yes but Why ?

2014-02-22 17:17 GMT+01:00 rillsoft notifications@github.com:

I have two bundle (CoreBundle, GuardBundle)
I want to GuardBundle-tables in create-script is defined in the first
place.

Reply to this email directly or view it on GitHubhttps://github.com//issues/273#issuecomment-35806457
.

@rillsoft
Copy link
Author

I have reference form CoreBundle to GuardBundle.
Order of tables to match.

AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
...
            new Rillsoft\GuardBundle\RillsoftGuardBundle(),
            new Rillsoft\CoreBundle\RillsoftCoreBundle(),
...

GuardBundle\Resources\config\schema.xml

<database name="default" namespace="Rillsoft\GuardBundle\Model" defaultIdMethod="native">
    <table skipSql="false" abstract="false" name="rill_guard_client" phpName="GuardClient">
        <column name="id" type="integer" required="true" primaryKey="true" />
        <column name="name" type="varchar" size="255" primaryString="true" required="true" />
        <column name="description" type="varchar" size="255" />
        <column name="is_active" type="boolean" required="true" default="1" />
    </table>
.....

CoreBundle\Resources\config\schema.xml

<database name="default" namespace="Rillsoft\CoreBundle\Model" defaultIdMethod="native">
    <table skipSql="false" abstract="false" name="rill_version" phpName="Version">
        <column name="id" type="integer" required="true" primaryKey="true" />
        <column name="client_id" type="integer" required="true" primaryKey="true" />
        <foreign-key foreignTable="rill_guard_client">
            <reference local="client_id" foreign="id" />
        </foreign-key>
        <unique name="uniq_version">
            <unique-column name="id" />
            <unique-column name="client_id" />
        </unique>
    </table>
....

@stood
Copy link

stood commented Feb 22, 2014

Plz to write your error because when you build propel, In a first time, propel create all the tables and a second time, it create FK.

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