0

やっけどダメでした。

私が作成しました:

propel.schema.xml

propel.schema.yml

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

他のデータベース構成は

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:           ~

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

私はこのコマンドを呼び出します:

php symfony propel:build-model

Web サイトにアクセスしたときに問題なく購入できました エラーが表示されます

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

このコマンドを呼び出すと:

php symfony propel:build --all

cmdのエラーは

  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

何か案が?

ありがとう

4

1 に答える 1

1

問題を解決しました。

propel.schema.yml、propel.schema.xml、orgdb.schema.yml、および orgdb.schema.xml を作成するときは、生成されたすべてのものを同じパッケージに入れるわけではないため、パッケージを入れる必要があります。次に、1つのスキーム(ymlとxml)または両方に追加できます

例えば

propel.schema.xmlで

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

そして propel.schema.yml で

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

幸運を。

于 2010-11-19T20:24:20.823 に答える