I am trying to create a fixture for a model where the model has a
table prefix using the current release of CakePHP 1.3

The model this is base on is called StateProvince

I have the following model class code
[code]
<?php
class StateProvince extends AppModel {
    public $name = 'StateProvince';
    public $tablePrefix = 'tbl_';

}
?>
[/code]

I have created a fixture for this as follows

[code]
<?php
class StateProvinceFixture extends CakeTestFixture {
       var $name = 'StateProvince';
       var $import = array('model' => 'StateProvince',
                           'records' => true,
                           'connection' => 'default');

}
?>
[/code]


And a test case like this
[code]
<?php
App::import('Model', 'StateProvince');

class StateProvinceTestCase extends CakeTestCase {
    var $fixtures = array( 'app.state_province' );

    public function testStates() {
        $this->StateProvice =& ClassRegistry::init('StateProvice');
        $result = $this->StateProvice->find('all');
        $this->assertEqual(true, is_array($result));
    }
}
?>
[/code]

When I try to run this test case is looks like its trying to setup the
model to get data to import into the fixture but I get the following
errors.

Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
relation "state_provinces" does not exist [CORE\cake\libs\model
\datasources\dbo\dbo_postgres.php, line 167]


Warning (512): SQL Error: ERROR:  relation "state_provinces" does not
exist [CORE\cake\libs\model\datasources\dbo_source.php, line 666]


Is there a bug in the fixtures code where it does not use the models
prefix when trying to import the structure into the fixture?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to