Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.2.0-BETA2, 1.2.0-RC1
-
Fix Version/s: None
-
Component/s: Import/Export
-
Labels:None
-
Environment:WAMP (Windows XP, Apache 2.2.11, MySQL 5.1.36, PHP 5.2.8), Doctrine 1.2.0-BETA2, Zend Framework 1.9.5
Description
When generating models using the following options:
generateBaseClasses = TRUE generateTableClasses = FALSE baseClassPrefix = "Base_" baseClassesDirectory = baseTableClassName = "Doctrine_Table" baseClassName = "Default_Model_Base_Abstract" classPrefix = "Default_Model_" classPrefixFiles = FALSE pearStyle = TRUE
no tables are generated in the database when calling
Doctrine_Core::createTablesFromModels('/application/models/');
.
-
Hide
- Test_Doctrine.zip
- 30/Nov/09 3:51 PM
- 1.45 MB
- KONDRATEK Nicolas
-
- Test_Doctrine/doctrine/CHANGELOG 23 kB
- Test_Doctrine/doctrine/COPYRIGHT 0.9 kB
- Test_Doctrine/doctrine/.../sql/tables.sql 0.0 kB
- Test_Doctrine/doctrine/lib/Doctrine.php 2 kB
- Test_Doctrine/doctrine/.../Access.php 5 kB
- Test_Doctrine/doctrine/.../Exception.php 1 kB
- Test_Doctrine/doctrine/.../Interface.php 2 kB
- Test_Doctrine/doctrine/.../Adapter/Mock.php 7 kB
- Test_Doctrine/doctrine/.../Oracle.php 9 kB
- Test_Doctrine/doctrine/.../Statement.php 4 kB
- Test_Doctrine/doctrine/.../Interface.php 14 kB
- Test_Doctrine/doctrine/.../Mock.php 16 kB
- Test_Doctrine/doctrine/.../Oracle.php 24 kB
- Test_Doctrine/doctrine/.../AuditLog.php 6 kB
- Test_Doctrine/doctrine/.../Listener.php 5 kB
- Test_Doctrine/doctrine/.../Builder.php 2 kB
- Test_Doctrine/doctrine/lib/.../Cache/Apc.php 3 kB
- Test_Doctrine/doctrine/.../Cache/Array.php 3 kB
- Test_Doctrine/doctrine/lib/.../Cache/Db.php 7 kB
- Test_Doctrine/doctrine/.../Cache/Driver.php 9 kB
- Test_Doctrine/doctrine/.../Exception.php 1 kB
- Test_Doctrine/doctrine/.../Interface.php 3 kB
- Test_Doctrine/doctrine/.../Memcache.php 4 kB
- Test_Doctrine/doctrine/.../Cache/Xcache.php 3 kB
- Test_Doctrine/doctrine/.../Doctrine/Cli.php 21 kB
- Test_Doctrine/.../AnsiColorFormatter.php 5 kB
- Test_Doctrine/doctrine/.../Cli/Exception.php 1 kB
- Test_Doctrine/doctrine/.../Cli/Formatter.php 3 kB
- Test_Doctrine/doctrine/.../Collection.php 28 kB
- Test_Doctrine/doctrine/.../Exception.php 1 kB
Activity
Got it to work.
However, is there a way to make the names of tables created by behaviours, such as "I18n" not be prepended by the specified classPrefix? There are tables generated like
default__model__content__translation
, while the corresponding table is named
content
. It would be nice if these tables were named without using the classPrefix, and it would be nice if the desired effect could be achieved without having to specifiy the name of the table in the schema such as
Content:
columns:
id:
type: integer(4)
primary: true
autoincrement: true
content_id:
type: integer(4)
notnull: false
disabled:
type: boolean
default: false
headline:
type: string(64)
notnull: false
content:
type: string(2000)
notnull: false
indexes:
content_id:
fields: content_id
relations:
Content:
foreign: id
local: content_id
actAs:
Timestampable:
SoftDelete:
I18n:
tableName: content_translation
actAs:
Timestampable:
SoftDelete:
fields: [headline, content]
When specifying the schema for the model it isn't necessary to specify the table name either, and the table still gets generated without the classPrefix.
With "working as before" (i.e., w/o PEAR style generation) , I meant that I wondered whether it would only be necessary to adjust code where I create instances of models directly or call methods contained, i.e.,
$content = new Default_Model_Content(); $something = Default_Model_Content::doSomething();
instead of
$content = new Content(); $something = Content::doSomething();
or whether it would be necessary to adjust queries using DQL, too, i.e..,
$contentCollection = Doctrine_Query::create()->from('Default_Model_Content c')->where('c.disabled = ?')->execute(array(1));
instead of
$contentCollection = Doctrine_Query::create()->from('Content c')->where('c.disabled = ?')->execute(array(1));
Hi,
I've the same problem.
My Models are generated form Yml files, but Database isn't generated from Models.
It's only with v.1.2, with v1.1 all is OK.
I send an attachment, it's a small project that don't work for me...
A have got very similar problem http://www.doctrine-project.org/jira/browse/DC-344 method Doctrine_Core::createTablesFromModels('models'); realy not working.
I sort of solved the issue by calling
Doctrine_Core::createTablesFromModels();
without specifying a model directory, while making sure the models have been loaded before.
This is working for me and all the tests for this functionality are passing. Make sure that before you call
Doctrine_Core::createTablesFromModels('models');That you aren't loading/requiring any of your model classes. In order for createTablesFromModels() to know what models are in the given path it has to be able require files in the path to determine what classes are in the files.