3 * [476] Adding includeAndInstatiateModels and uninstallAndInstallMigration to AkUnitTest
5 * Making it possible to include models by default by declaring in your application_controller.php
8 var $app_models = 'user,role';
11 this way you can avoid adding controller-wide models into every single controller.
13 * HTTP authentication now can have its own failure message by implementing a **access_denied** method into the application controller.
15 ----------------------
17 * Model generator now supports customizing first migration version column setting from the command line like:
19 ./generate model Video title, length double, author, is_searchable
21 * Relocated Active Record database adapters, behaviors and associations into lib/AkActiveRecord/AkDbAdapters, AkActsAsBehaviours and AkAssociations respectively.
25 ## Merging Kaste's branch with the trunk.
27 WARNING: IMPORTANT CHANGES AHEAD!
29 * [387] Refactored AkActiveRecord::find().
30 * [387] API-change: removed find('first', $id, $options) cause finding one id is always "first". Use find($id, $options); instead.
31 * [395] Deprecated AkActiveRecord::find($sql) which silently expanded to AkActiveRecord::find('first', $sql).
32 This was ambiguous because find($sql, $bind_variables*) expanded to find('all',*)
33 Use AkActiveRecord::find('first', $sql) instead.
34 * [396] Added AkDbAdapter between ADODb and the Active Record.
35 * [396] Expanded AkUnitTest so its easy to generate Models on the fly like:
37 $AkUnitTest->installAndIncludeModels(array('Article'=>'id,name,description'));
39 Creates the table 'articles' with specified columns and builds the ActiveRecord Model (class) 'Article'.
40 * [396] AkActiveRecord::toYaml now handles ActiveRecord collections.
42 User::toYaml($found_users);
44 * [407] Fixed typos on the Active Record like $asssociated_ids....
45 * [407] Improved and refactored Active Record unit tests.
46 * [405] Fixed AkHasAndBelongsToMany/AkHasMany::getAssociatedModelInstance which Singleton was badly implemented.
47 * [416] Avoided unsetting database profiles.
48 * [416] Added support for extra database profiles you can quickly test with different db-adapters like:
50 ActiveRecord::establishConnection('super_user');
51 ./test _some_test_case.php sqlite_test_profile
53 * [417] Changed NewDataDictionary(db->connection) to db->getDictionary();
54 * [418] AkHasAndBelongsToMany now uses AkInstaller to create the join table. Because of that it creates the sequence_table for sqlite straight away.
55 * [419] Fixed singleton implementation of Ak::getLogger()
56 * [425] AkInstaller: Added magic 'lock_version' column.
58 'lock_version' => 'lock_version int default=1'
60 * [427] Refactored the Active Record "callback"-chain. Fixes #95 and #94.
61 * [427] Added create, update and execute methods to AkDbAdapter.
62 * [428] Adding support for late bindings on AkDbAdapter::execute()
63 This allows you to safely sanitize parameters before adding them to your custom SQL queries.
65 AkDbAdapter::execute(array('select * from articles where id=?', 1));
67 * [429] Added addLimitAndOffset method to AkDbAdapter for delegating limits and offsets.
68 * [431] Implemented renameColumn in AkDbAdapter. Closes #47 and #96.
69 * [436] Removed AkActiveRecord::sqlSelect* (now in AkDbAdapter)
70 * [437] Moved transactions to AkDbAdapter
71 * [439] Fixed a serious issue in a TEST that could lead to data loss in the development database.
72 * [441] Replacing MetaTables() and MetaColumns() with AkDbAdapter::availableTables() and AkDbAdapter::getColumnDetails($table).
73 * [446] Improved the MenuHeper
74 * [446] Changed default options for AkPluginManager::updatePlugin(). Disables externals and checkout.
75 * [448] AkActiveRecord::findBySql now uses AkDbAdapter::select
76 * [450] AkActiveRecord::incrementCounter() and decrementCounter() now are pseudo-static.
77 * [450] AkActiveRecord::updateAttribute() now validates when saving by default. Pass 'false' as third argument to bypass validation.
78 * [451] AkInstaller automatically sets '*_count'-columns => 'columnname int default 0'
79 * [458] Fixed #103, quoting strings on PostgreSQL.
80 * [459] Adding decimal-type support on Active Records.
81 * [459] Datatypes for PostgreSQL changed. You need to update/change your table schemas! Run migrations!
82 Before this, we kinda hacked Mysql-behavior into PostgreSQL. Thus we didnt used features of Postgre on one side.
84 In the long run we had to fix - better now than later - since the design problems only "multiply" when time goes by.
86 At this point we wanted to implement the decimal/numeric datatype. And so we had to decide whether to hack further or to solve the underlying issue. This means we HAD to correct a wrong implementation.
88 (simplified type>) Akelos Postgre (<Actual Type)
93 integer => numeric(X,0)
97 integer => integer (int4)
100 To guide you through this we'll have a test at test/unit/lib/AkActiveRecord/_PostgreSQL_datatype_migration.php.
102 First make you comfortably with this test and make it pass. This is a test against a dummy-table of course.
103 (When you're on Postgre 7 you have to modify this test. But you'll see that.)
105 Next write appropriate migrations/installers for your real tables. (Again: You should always begin with a test.)
107 Keep in mind that we typecast TINYINT as boolean on MySQL. So you cannot use tinyint for other things.
108 * [459] Boolean columns now actually have three possible states: true, false and null. Before that null=>false!
109 * [461] ActiveRecordHelper::error_messages_for and error_message_on now translate the error messages.
110 * [467] NULL values can be saved on boolean and decimal columns. Fixes #114 and #113.
112 #### End of Kaste merge
116 * AkInstaller::createTable() will now add created_at and updated_at columns automatically unless you have one of
117 them in your table declaration or set the option 'timestamp' => false
120 $this->createTable('user', 'id, first_name, last_name, email'); // will add created_at, and updated_at
126 $this->createTable('user', 'id, first_name, last_name, email', array('timestamp'=>false)); // nothing extra
132 $this->createTable('user', 'id, first_name, last_name, email, updated_at'); // nothing extra
135 * Simplifying unit test calls for models and core tests. Updated generators to reflect this new way of calling tests.
136 If you stick with the convention of prefixing your test cases with TestCase you will no longer need to call ak__test('testcaseclass')
138 Running models test can now be done with simply
139 ./script/test model User
141 Core tests can be called without the full path like
142 ./script/test AkActiveRecord
144 * Rearranged scripts to include as little code as possible in the application space. This should make updates easier.
146 * Removed AkInflector::modulize as it had a misleading name, use AkInflector::classify instead [420]
148 * Added support for HTTP Authentication [412]. Example:
152 class PostController extends ApplicationController
154 var $_authorized_users = array('bermi' => 'secret');
156 function __construct()
158 $this->beforeFilter(array('authenticate' => array('except' => array('index'))));
163 $this->renderText("Everyone can see me!");
168 $this->renderText("I'm only accessible if you know the password");
171 function authenticate()
174 * You can either use an array like $this->_authorized_users or
175 * an Model instance that implements an authenticate method like Model::authenticate($user,$pass, $controller);
177 return $this->_authenticateOrRequestWithHttpBasic('My Blog', $this->_authorized_users);
183 * Added public/500.php and public/404.php for handling errors on production mode.
187 ----------------------
189 * First public release