This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » General plug-ins » [sfGuard] how to correctly use propel-build-schema after sfGuardPlugin installation?
[sfGuard] how to correctly use propel-build-schema after sfGuardPlugin installation? [message #21387] Sat, 10 February 2007 23:54 Go to previous message
qube  is currently offline qube
Messages: 88
Registered: August 2006
Location: Czech republic
Member
Hi,

I experienced following problem after installing sfGuardPlugin

...
[propel-om] Processing: generated-schema.xml
[propel-om] Processing: generated-sfGuardPlugin-schema.xml
Execution of target "om-template" failed for the following reason: 
C:\php51\PEAR\symfony\vendor\propel-generator\build-propel.xml:436:1: Duplicate table found: propel.


update: This problem is caused by building your schema from database (propel-build-schema) command after sfGuardPlugin installation. Propel-build-schema command generates schema.yml with sfGuard tables and therefor tables are defined twice. Once in /config/schema.yml and once in /plugins/sfGuardPlugin/config/schema.yml.

If you need to use propel-build-schema, you can try following solutions (none is perfect):

1) Most clean solution would be, to delete table definitions from generated schema.yml after running propel-build-schema. But this is not very convenient.

2) Edit propel.ini and set
propel.packageObjectModel = false
I don't know what exactly this switch do, but it solves many problems, when I look around the forum.
(found here: http://www.symfony-project.com/forum/index.php/m/21319/?srch =propel.packageObjectModel#msg_21319).

3) Rename database name in one of the schemas:
<database name="propel2" defaultIdMethod="native" package="plugins.sfGuardPlugin.lib.model">

If you do this, you must update database.yml and set connection parameters for your second database name. Maybe there are other consequences I'm not aware of.

This works regardless on settings of propel.packageObjectModel in propel.ini.

4) Delete /plugins/sfGuardPlugin/config/schema.yml, /plugins/sfGuardPlugin/config/schema.xml. By doing this, there is only one definition of tables and thus no problem for Propel.
(as advised by blizzard-media here: http://www.symfony-project.com/forum/index.php/t/4205/)


All these solutions (except 1)) have disadvantage, that sfGuard classes are generated into your /lib/model directory. But despite of this, model classes from /plugins/sfGuardPlugin/lib/model are used anyway.

Note: When experimenting with various settings, clear you cache and cookies, otherwise you can get following error:
Fatal error: Cannot redeclare class sfguardusermapbuilder in ...\plugins\sfGuardPlugin\lib\model\map\sfGuardUserMapBuilder.php on line 5



Is there some correct solution how to use propel-build-schema wit installed plugin, which has own db tables?

[Updated on: Sun, 11 February 2007 16:12]

Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:[New plugin]sfFilebasePlugin
Next Topic:sfAssetsLibraryPlugin 1.0 - not displaying form labels
Goto Forum:

  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software