0

I did it but It did not work.

I created:

propel.schema.xml

propel.schema.yml

# config/propel.schema.yml
propel:
  article:
    id:           ~

the other db configuration is

orgdb.schema.xml

<?xml version="1.0" encoding="UTF-8"?>
 <database name="orgdb" defaultIdMethod="native" noXsd="true" package="lib.model">
 <table name="organization">
   <column name="id" type="INTEGER" primaryKey="true" required="true" autoIncrement="true"/>   

orgdb.schema.yml

# config/orgdb.schema.yml
orgdb:
  organization:
    id:           ~

in database.yml

# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/07-Databases

dev:
  propel:
    param:
      classname:  DebugPDO
      debug:
        realmemoryusage: true
        details:
          time:       { enabled: true }
          slow:       { enabled: true, threshold: 0.1 }
          mem:        { enabled: true }
          mempeak:    { enabled: true }
          memdelta:   { enabled: true }

test:
  propel:
    param:
      classname:  DebugPDO

all:
  propel:
    class:        sfPropelDatabase
    param:
      classname:  PropelPDO
      dsn:        mysql:dbname=db1;host=localhost
      username:   
      password:   
      encoding:   utf8
      persistent: true
      pooling:    true

  orgdb:
    class:        sfPropelDatabase
    param:
      classname:  PropelPDO
      dsn:        mysql:dbname=db2;host=localhost
      username:   
      password:   
      encoding:   utf8
      persistent: true
      pooling:    true

I call this command:

php symfony propel:build-model

I haven't problem buy when I in to the web site I see the error

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db1.organization' doesn't exist

when I call this command:

php symfony propel:build --all

the error in cmd is

  Fatal error: Call to a member function addTable() on a non-object in C:\PHP...\lib\vendor\symfony\lib\plugins\sfpropelPlugin\lib\vendor\propel-generator\classes\propel\phing\PropelSQLTask.php on line 237

any idea?

Thanks

1 Answer 1

1

I solved the problem.

when you create the propel.schema.yml, propel.schema.xml, orgdb.schema.yml and orgdb.schema.xml you need to put the package becouse you do not put all the things generated in the same package. Then you can add it in one scheme(yml and xml) or in both

for example

in propel.schema.xml

<?xml version="1.0" encoding="UTF-8"?>
 <database name="propel" defaultIdMethod="native" noXsd="true" package="lib.model.propel">
    <table name="article">
     ...

and in propel.schema.yml

# config/propel.schema.yml
propel:
  _attributes: {package: lib.model.propel}
  article:
     ...

good luck.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.