documentation update + code fixes
This commit is contained in:
@ -6,7 +6,7 @@ This page is dedicated for those who prefer to use more or less default
|
||||
check [their readme](https://github.com/yiisoft/yii2-app-advanced#readme) file on why and when you should use it,
|
||||
for now we're going to explain on how Yii2 User Module extension could be used for the case if you prefer it.
|
||||
|
||||
> We highly recommend you to use [Sidekit Application Template](http://www.2amigos.us/) which has sensible default
|
||||
> We highly recommend you to use [Sidekit Application Template](https://github.com/sidekit/yii2-app-template) which has sensible default
|
||||
packages, and everything you need to start project in no time with batteries included! ;-)
|
||||
>
|
||||
> [Check this manual page](sidekit-application-template.md) if you decided to use it.
|
||||
@ -107,9 +107,5 @@ is very convenient way to track new migration classes coming from this and possi
|
||||
> Namespaced migrations were introduced in Yii 2.0.10, so before using them consider updating your framework
|
||||
> installation version.
|
||||
|
||||
What can I do now?
|
||||
------------------
|
||||
|
||||
Now you're ready to go and build something nice with help of our module extension. Perhaps you could check
|
||||
[how to use login and sign up forms]() gracefully built for your needs, or you can check out how you could
|
||||
[customize login form]() look'n'feel.
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
Basic Application Template
|
||||
==========================
|
||||
|
||||
TODO:
|
||||
@ -1,4 +1,83 @@
|
||||
Sidekit Application Template
|
||||
============================
|
||||
|
||||
TODO: promote our own application template first of all, and do it here ;-)
|
||||
Sidekit Application Template is our proposed structure for your Yii2 applications. It makes use
|
||||
of a special library named `SideKit`
|
||||
|
||||
> For further information regarding the use of this template, please visit its
|
||||
[README file](https://github.com/sidekit/yii2-app-template).
|
||||
|
||||
Step 1 - Install SideKit Application template
|
||||
----------------------------------------------
|
||||
|
||||
We will assume that you have composer installed globally on your computer and also the
|
||||
`fxp/composer-asset/plugin:^1.3` that is required for all Yii2 apps.
|
||||
|
||||
```bash
|
||||
composer create-project --prefer-dist --stability=dev sidekit/yii2-app-template your-site-name
|
||||
```
|
||||
|
||||
Step 2 - Configure your application
|
||||
-----------------------------------
|
||||
|
||||
Go to the `config/web/modules` folder and create a new PHP file named `user.php`. Then on in its
|
||||
contents write the configuration for the module:
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
return [
|
||||
'class' => Da\User\Module::class
|
||||
];
|
||||
```
|
||||
|
||||
Step 3 - Apply database schema migrations
|
||||
-----------------------------------------
|
||||
|
||||
This is obvious extension like our which deals with users, roles, permissions, etc. have to use some database.
|
||||
Our migrations are namespaced and available in `Da\User\Migration` namespace.
|
||||
|
||||
Before starting to work with database, please ensure you have deleted `m130524_201442_init.php` migration file
|
||||
which comes from the default installation of the Advanced Application Template. It's located at
|
||||
`%PROJECT_DIR%/console/migrations/m130524_201442_init.php` path.
|
||||
|
||||
There are two ways to apply migrations of this extension, the first one:
|
||||
|
||||
```php
|
||||
./yii migrate --migrationPath="@Da/User/Migration"
|
||||
./yii migrate
|
||||
```
|
||||
|
||||
First command applies migration set of the user module, and the second one is for application migrations.
|
||||
|
||||
> Note, you cannot mix two ways: choose one of them, and stick with it.
|
||||
|
||||
The second way is more comfortable, and you don't have to remember to launch first command every time you obtain
|
||||
new version of our extension. First of all add the following lines to the file
|
||||
`%PROJECT_DIR%/console/config/main.php`:
|
||||
|
||||
```php
|
||||
return [
|
||||
// ...
|
||||
'controllerMap' => [
|
||||
'migrate' => [
|
||||
'class' => \yii\console\controllers\MigrateController::class,
|
||||
'migrationNamespaces' => [
|
||||
'Da\User\Migration',
|
||||
],
|
||||
],
|
||||
],
|
||||
// ...
|
||||
];
|
||||
```
|
||||
|
||||
This basically instructs your application to always try to use migrations from the given namespace. Which again
|
||||
is very convenient way to track new migration classes coming from this and possibly other extensions and sources.
|
||||
|
||||
> Namespaced migrations were introduced in Yii 2.0.10, so before using them consider updating your framework
|
||||
> installation version.
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user