Browse Source

Adjusted unit tests, added description to docs

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
5c3e4fa4ba
  1. 9
      docs/guide/active-record.md
  2. 1
      tests/unit/framework/db/ActiveRecordTest.php

9
docs/guide/active-record.md

@ -193,6 +193,15 @@ Customer::updateAllCounters(['age' => 1]);
> Info: The `save()` method will either perform an `INSERT` or `UPDATE` SQL statement, depending
on whether the ActiveRecord being saved is new or not by checking `ActiveRecord::isNewRecord`.
In order to load default values from database schema you may call `loadDefaultValues()` method:
```php
$customer = new Customer();
$customer->loadDefaultValues();
$cusomer->name = 'Alexander';
$customer->save();
```
Data Input and Validation
-------------------------

1
tests/unit/framework/db/ActiveRecordTest.php

@ -491,6 +491,7 @@ class ActiveRecordTest extends DatabaseTestCase
public function testDefaultValues()
{
$model = new Type();
$model->loadDefaultValues();
$this->assertEquals(1, $model->int_col2);
$this->assertEquals('something', $model->char_col2);
$this->assertEquals(1.23, $model->float_col2);

Loading…
Cancel
Save