Chernovm / sky-coding-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yii 2 Advanced Project Template


First coding exercise:

Create sample registration form for both legal bodies and individual persons

Files changes:

  • common/config/main-local.php - modify db component for selected dbms and created db
  • console/migrations/m130524_201442_init.php - create table for ActiveRecords created by form
  • common/models/SkyUser.php - ActiveRecord for models created by form
  • frontend/assets/RegistrationAsset.php - asset for interactive form's fields hide/show actions
  • frontend/controllers/SiteController.php - modify actionIndex (display all SkyUser models), implement actionRegistration (main action for form)
  • frontend/models/RegistrationForm.php - form's model for data validation and saving
  • frontend/views/site/registration.php - main form's view file

Preparing application

After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.

  1. Open a console terminal, execute the init command and select dev as environment.

    /path/to/php-bin/php /path/to/yii-application/init
    

    If you automate it with a script you can execute init in non-interactive mode.

    /path/to/php-bin/php /path/to/yii-application/init --env=Development --overwrite=All
    
  2. Create a new database and adjust the components['db'] configuration in /path/to/yii-application/common/config/main-local.php accordingly.

  3. Open a console terminal, apply migrations with command /path/to/php-bin/php /path/to/yii-application/yii migrate.

  4. Set document roots of your web server:

    • for frontend /path/to/yii-application/frontend/web/ and using the URL http://frontend.test/
    • for backend /path/to/yii-application/backend/web/ and using the URL http://backend.test/

We'll need to use only frontend.test domain: http://frontend.test/index.php?r=site%2Fregistration - url for main actions

About

License:Other


Languages

Language:PHP 91.6%Language:CSS 3.4%Language:Shell 2.8%Language:JavaScript 1.3%Language:Batchfile 0.9%