diff --git a/README.md b/README.md index 6b2214dcf..77abd3681 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ composer require yiisoft/active-record Example: ```php -composer require yiisoft/db-mysql +composer require yiisoft/db-sqlite ``` -## Configuration container di autowired +## Config container interface class web.php: ```php @@ -54,7 +54,7 @@ web.php: declare(strict_types=1); use Yiisoft\Db\Connection\ConnectionInterface; -use Yiisoft\Db\Sqlite\Connection as SqliteConnection; +use Yiisoft\Db\Sqlite\Connection; use Yiisoft\Db\Sqlite\Driver; /** @@ -62,7 +62,7 @@ use Yiisoft\Db\Sqlite\Driver; */ return [ ConnectionInterface::class => [ - 'class' => SqliteConnection::class, + 'class' => Connection::class, '__construct()' => [ 'driver' => new Driver($params['yiisoft/db-sqlite']['dsn']), ], @@ -83,7 +83,8 @@ return [ ] ``` -defined your active record, example User.php: +## Defined your active record class + ```php [ - 'class' => SqliteConnection::class, - '__construct()' => [ - 'driver' => new Driver($params['yiisoft/db-sqlite']['dsn']), - ], - ], - - ActiveRecordFactory::class => [ - 'class' => ActiveRecordFactory::class, - '__construct()' => [ - null, - [ConnectionInterface::class => Reference::to(SqliteConnection::class)], - ] - ] -]; -``` - -params.php -```php - [ - 'dsn' => 'sqlite:' . dirname(__DIR__) . '/runtime/yiitest.sq3', - ] -] -``` - -defined your active record, example User.php: -```php -