#6135: Unable to load record fixtures from MS SQL -------------------------------+-------------------------------------------- Reporter: reuben.helms | Type: Bug Status: new | Priority: Medium Milestone: 1.2.x.x | Component: Test Suite Version: 1.2 Final | Severity: Normal Keywords: MSSQL fetchAll | Php_version: PHP 5 Cake_version: | -------------------------------+-------------------------------------------- Record fixtures are unable to be loaded from MSSQL databases, due to the table name not being included when records are fetched from the database.
In cake/tests/lib/cake_test_fixture.php, on line 104, a fetchAll will successfully grab records from the database. However, database records collected via fetchAll() for MSSQL datasources do no contain the model alias in the array structure. i.e. Array([0]=>Array([0]=>Array([id]=>1 [name]=>Fred))) instead of Array([0]=>Array([Alias]=>Array([id]=>1 [name]=>Fred))) The Set::extract statement at line 107 relies on the alias being set correctly, to store the final version of $this->records. The fix is difficult. The ultimate solution would be for resultSet(dbo_mssql.php, line 496) to successfully identify the table name and populate in the map. Unfortunately, MS SQL doesnt seem to make that task easy. The next best solution is to use the modelName value is fetchAll(dbo_source.sql, line 330). Currently, the field is not used at all, though it could be used to override the key used in $first and $item (lines 342 and 345 of dbo_source.php). Failing that, the code at line 107 of cake_test_fixture.php could do a double check to make sure that $model->alias has actually been used during the fetchAll. In the meantime, users will have to use $records for their fixtures instead of database data for MSSQL installations. -- Ticket URL: <https://trac.cakephp.org/ticket/6135> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---