3 * [511] Action Controllers now will automatically load singular named helpers and models if the controller has the plural form.
5 * [510] Added a handy utility for modifying arrays which is useful for securing record creation/updating.
7 If you have this code on a controller
9 $this->user->setAttributes($this->params['user']);
12 and your users table has a column named is_admin. All it would take to a malicious user is to modify the page html to add the need field and gain admin privileges.
14 You could avoid by using the new Ak::pick method which will return and array with desired keys.
17 $this->user->setAttributes(Ak::pick('name,email', $this->params['user']));
20 * [509] Parameters given to url_for do not need to be urlencoded anymore. This allows using variables with slashes.
22 * [476] Adding includeAndInstatiateModels and uninstallAndInstallMigration to AkUnitTest
24 * Making it possible to include models by default by declaring in your application_controller.php
27 var $app_models = 'user,role';
30 this way you can avoid adding controller-wide models into every single controller.
32 * HTTP authentication now can have its own failure message by implementing a **access_denied** method into the application controller.
34 ----------------------
36 * Model generator now supports customizing first migration version column setting from the command line like:
38 ./generate model Video title, length double, author, is_searchable
40 * Relocated Active Record database adapters, behaviors and associations into lib/AkActiveRecord/AkDbAdapters, AkActsAsBehaviours and AkAssociations respectively.
44 ## Merging Kaste's branch with the trunk.
46 WARNING: IMPORTANT CHANGES AHEAD!
48 * [387] Refactored AkActiveRecord::find().
49 * [387] API-change: removed find('first', $id, $options) cause finding one id is always "first". Use find($id, $options); instead.
50 * [395] Deprecated AkActiveRecord::find($sql) which silently expanded to AkActiveRecord::find('first', $sql).
51 This was ambiguous because find($sql, $bind_variables*) expanded to find('all',*)
52 Use AkActiveRecord::find('first', $sql) instead.
53 * [396] Added AkDbAdapter between ADODb and the Active Record.
54 * [396] Expanded AkUnitTest so its easy to generate Models on the fly like:
56 $AkUnitTest->installAndIncludeModels(array('Article'=>'id,name,description'));
58 Creates the table 'articles' with specified columns and builds the ActiveRecord Model (class) 'Article'.
59 * [396] AkActiveRecord::toYaml now handles ActiveRecord collections.
61 User::toYaml($found_users);
63 * [407] Fixed typos on the Active Record like $asssociated_ids....
64 * [407] Improved and refactored Active Record unit tests.
65 * [405] Fixed AkHasAndBelongsToMany/AkHasMany::getAssociatedModelInstance which Singleton was badly implemented.
66 * [416] Avoided unsetting database profiles.
67 * [416] Added support for extra database profiles you can quickly test with different db-adapters like:
69 ActiveRecord::establishConnection('super_user');
70 ./test _some_test_case.php sqlite_test_profile
72 * [417] Changed NewDataDictionary(db->connection) to db->getDictionary();
73 * [418] AkHasAndBelongsToMany now uses AkInstaller to create the join table. Because of that it creates the sequence_table for sqlite straight away.
74 * [419] Fixed singleton implementation of Ak::getLogger()
75 * [425] AkInstaller: Added magic 'lock_version' column.
77 'lock_version' => 'lock_version int default=1'
79 * [427] Refactored the Active Record "callback"-chain. Fixes #95 and #94.
80 * [427] Added create, update and execute methods to AkDbAdapter.
81 * [428] Adding support for late bindings on AkDbAdapter::execute()
82 This allows you to safely sanitize parameters before adding them to your custom SQL queries.
84 AkDbAdapter::execute(array('select * from articles where id=?', 1));
86 * [429] Added addLimitAndOffset method to AkDbAdapter for delegating limits and offsets.
87 * [431] Implemented renameColumn in AkDbAdapter. Closes #47 and #96.
88 * [436] Removed AkActiveRecord::sqlSelect* (now in AkDbAdapter)
89 * [437] Moved transactions to AkDbAdapter
90 * [439] Fixed a serious issue in a TEST that could lead to data loss in the development database.
91 * [441] Replacing MetaTables() and MetaColumns() with AkDbAdapter::availableTables() and AkDbAdapter::getColumnDetails($table).
92 * [446] Improved the MenuHeper
93 * [446] Changed default options for AkPluginManager::updatePlugin(). Disables externals and checkout.
94 * [448] AkActiveRecord::findBySql now uses AkDbAdapter::select
95 * [450] AkActiveRecord::incrementCounter() and decrementCounter() now are pseudo-static.
96 * [450] AkActiveRecord::updateAttribute() now validates when saving by default. Pass 'false' as third argument to bypass validation.
97 * [451] AkInstaller automatically sets '*_count'-columns => 'columnname int default 0'
98 * [458] Fixed #103, quoting strings on PostgreSQL.
99 * [459] Adding decimal-type support on Active Records.
100 * [459] Datatypes for PostgreSQL changed. You need to update/change your table schemas! Run migrations!
101 Before this, we kinda hacked Mysql-behavior into PostgreSQL. Thus we didnt used features of Postgre on one side.
103 In the long run we had to fix - better now than later - since the design problems only "multiply" when time goes by.
105 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.
107 (simplified type>) Akelos Postgre (<Actual Type)
111 boolean => numeric(1)
112 integer => numeric(X,0)
116 integer => integer (int4)
119 To guide you through this we'll have a test at test/unit/lib/AkActiveRecord/_PostgreSQL_datatype_migration.php.
121 First make you comfortably with this test and make it pass. This is a test against a dummy-table of course.
122 (When you're on Postgre 7 you have to modify this test. But you'll see that.)
124 Next write appropriate migrations/installers for your real tables. (Again: You should always begin with a test.)
126 Keep in mind that we typecast TINYINT as boolean on MySQL. So you cannot use tinyint for other things.
127 * [459] Boolean columns now actually have three possible states: true, false and null. Before that null=>false!
128 * [461] ActiveRecordHelper::error_messages_for and error_message_on now translate the error messages.
129 * [467] NULL values can be saved on boolean and decimal columns. Fixes #114 and #113.
131 #### End of Kaste merge
135 * AkInstaller::createTable() will now add created_at and updated_at columns automatically unless you have one of
136 them in your table declaration or set the option 'timestamp' => false
139 $this->createTable('user', 'id, first_name, last_name, email'); // will add created_at, and updated_at
145 $this->createTable('user', 'id, first_name, last_name, email', array('timestamp'=>false)); // nothing extra
151 $this->createTable('user', 'id, first_name, last_name, email, updated_at'); // nothing extra
154 * Simplifying unit test calls for models and core tests. Updated generators to reflect this new way of calling tests.
155 If you stick with the convention of prefixing your test cases with TestCase you will no longer need to call ak__test('testcaseclass')
157 Running models test can now be done with simply
158 ./script/test model User
160 Core tests can be called without the full path like
161 ./script/test AkActiveRecord
163 * Rearranged scripts to include as little code as possible in the application space. This should make updates easier.
165 * Removed AkInflector::modulize as it had a misleading name, use AkInflector::classify instead [420]
167 * Added support for HTTP Authentication [412]. Example:
171 class PostController extends ApplicationController
173 var $_authorized_users = array('bermi' => 'secret');
175 function __construct()
177 $this->beforeFilter(array('authenticate' => array('except' => array('index'))));
182 $this->renderText("Everyone can see me!");
187 $this->renderText("I'm only accessible if you know the password");
190 function authenticate()
193 * You can either use an array like $this->_authorized_users or
194 * an Model instance that implements an authenticate method like Model::authenticate($user,$pass, $controller);
196 return $this->_authenticateOrRequestWithHttpBasic('My Blog', $this->_authorized_users);
202 * Added public/500.php and public/404.php for handling errors on production mode.
206 ----------------------
208 * First public release