azraf / yii2-simple

A yii2 package comes with pre-installed jquery UI, RBAC (mdmsoft/yii2-admin), User profile (dektrium/yii2-user), upload files plugin (mdmsoft/yii2-upload-file) and few more coming to boostup initial development time.
MIT License
34 stars 19 forks source link

Installation error #2

Open lestat1968 opened 9 years ago

lestat1968 commented 9 years ago

Hi, azraf

I installed your yii2-simple application, but i obtain this error:

exception 'yii\base\InvalidParamException' with message 'Invalid path alias: @dektrium/user/views' in C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\BaseYii.php:151
Stack trace:
#0 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\Theme.php(149): yii\BaseYii::getAlias('@dektrium/user/...')
#1 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\View.php(219): yii\base\Theme->applyTo('C:\wamp\www2\yi...')
#2 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\web\ErrorHandler.php(192): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#3 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\web\ErrorHandler.php(97): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#4 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\ErrorHandler.php(85): yii\web\ErrorHandler->renderException(Object(yii\base\UnknownMethodException))
#5 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\base\UnknownMethodException))
#6 {main}
Previous exception:
exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: yii\web\UrlManager::addRules()' in C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\Component.php:285
Stack trace:
#0 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2-debug\Module.php(128): yii\base\Component->__call('addRules', Array)
#1 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2-debug\Module.php(128): yii\web\UrlManager->addRules(Array, false)
#2 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\Application.php(294): yii\debug\Module->bootstrap(Object(yii\web\Application))
#3 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\web\Application.php(62): yii\base\Application->bootstrap()
#4 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\Application.php(251): yii\web\Application->bootstrap()
#5 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\Object.php(106): yii\base\Application->init()
#6 C:\wamp\www2\yii2simple\vendor\yiisoft\yii2\base\Application.php(190): yii\base\Object->__construct(Array)
#7 C:\wamp\www2\yii2simple\web\index.php(12): yii\base\Application->__construct(Array)
#8 {main}

How i can solve it?

abhi1693 commented 9 years ago

Can you paste your config file?

lestat1968 commented 9 years ago

this is my web.php

<?php

$params = require(__DIR__ . '/params.php');

$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'modules' => [
        'user' => [
            'class' => 'dektrium\user\Module',
            'controllerMap' => [
                'security' => 'app\controllers\SecurityController',
            ],
            'enableConfirmation' => false,
            'confirmWithin' => 21600,
            'cost' => 12,
            'admins' => ['admin']
        ],
        'admin' => [
            'class' => 'mdm\admin\Module',
            'layout' => 'left-menu', // avaliable value 'left-menu', 'right-menu' and 'top-menu'
//            'layout' => 'right-menu', // avaliable value 'left-menu', 'right-menu' and 'top-menu'
//            'layout' => 'top-menu', // avaliable value 'left-menu', 'right-menu' and 'top-menu'
            'controllerMap' => [
                 'assignment' => [
                    'class' => 'mdm\admin\controllers\AssignmentController',
                    'userClassName' => 'dektrium\user\models\User',
                    'idField' => 'id'
                ]
            ],
            'menus' => [
                'assignment' => [
                    'label' => 'Grand Access' // change label
                ],
//                'route' => null, // disable menu
                'route' => [
                    'label' => 'Route'
                ]
            ],
        ],
    ],
    'components' => [
        'request' => [
            // this is required by cookie validation
            'cookieValidationKey' => '1upyWl1e2z6H3sCnwgv2zqDNkRE5OVqg',
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'authManager' => [
            'class' => 'yii\rbac\PhpManager',
            'defaultRoles' => ['admin','editor','client','agent','user'], // here define your roles
            //'authFile' => '/commands/data/rbac.php' //the default path for rbac.php | OLD CONFIGURATION
            'itemFile' =>       dirname(__DIR__) . '/commands/data/items.php', //Default path to items.php | NEW CONFIGURATIONS
            'assignmentFile' => dirname(__DIR__) . '/commands/data/assignments.php', //Default path to assignments.php | NEW CONFIGURATIONS
        'ruleFile' =>       dirname(__DIR__) . '/commands/data/rules.php', //Default path to rules.php | NEW CONFIGURATIONS
        ],
        'user' => [
            'identityClass' => 'dektrium\user\models\User',
        ],
        'wtsecure' => [
            'class' =>  'azraf\simpleapp\classes\SimpleSecurity',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => true, // If you want to hide `index.php` from URL, make it false and set a .htaccess file
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'session' => [
            'class' => 'yii\web\DbSession',
            // 'db' => 'mydb',  // the application component ID of the DB connection. Defaults to 'db'.
            // 'sessionTable' => 'my_session', // session table name. Defaults to 'session'.
        ],
        'view' => [
            'theme' => [
                'pathMap' => [
                    '@dektrium/user/views' => '@app/views/user'
                ],
            ],
        ],
        'i18n' => [
            'translations' => [
                        '*' => [
                                'class' => 'yii\i18n\PhpMessageSource',
                                'basePath' => '@app/messages', // if advanced application, set @frontend/messages
                                'sourceLanguage' => 'en',
                                'fileMap' => [
                                        //'main' => 'main.php',
                                ],
                        ],
                ],
        ],
        'db' => require(__DIR__ . '/db.php'),
    ],
    'as access' => [
        'class' => 'mdm\admin\components\AccessControl',
        'allowActions' => [
            'admin/*',  // ::: IMPORTANT :::: Make it disable after configuring the USER Roles/Permissions
            'user/index', // add or remove allowed actions to this list
            'user/login', // add or remove allowed actions to this list
            'user/security/login', // add or remove allowed actions to this list
            'user/logout', // add or remove allowed actions to this list
            'user/security/logout', // add or remove allowed actions to this list
            'user/register', // add or remove allowed actions to this list
            'user/registration/register', // add or remove allowed actions to this list
            'user/registration/confirm', // add or remove allowed actions to this list
            'user/registration/resend', // add or remove allowed actions to this list
            'user/registration/connect', // add or remove allowed actions to this list

            'site/index',
            'site/about',
            'site/contact',
            'site/signup',
            'site/logout',
            'site/login'
            ]
    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii\debug\Module';

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\gii\Module';
}

return $config;
neatbasis commented 9 years ago

I have the same exact config. Pulled the repo today and didn't get it working. I would also appreciate if someone has a fix for this.

valonsoft commented 9 years ago

someone should please address this issue as am also having the same problem

jsobers1331 commented 9 years ago

I'm also having this problem...Can you help with this issue @dmeroff? Seems to be concerning your module as well. I just updated my branch with all recent changes for my dependencies and also broke my application.

dmeroff commented 9 years ago

@jsobers1331 It seems that you are using old Yii2 version (may be beta). You should update to the latest yii2 version. This may happen if you don't have asset-plugin installed.

jsobers1331 commented 9 years ago

Following the Upgrade instructions for Yii2 didn't work for me. I actually had to use

composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta1"

then

composer.phar update

To fix my issue.

@dmeroff you were right, my version of Yii was older, then those i used their recommended composer asset.

Hope this is helpful for others who have come across this issue.

valonsoft commented 9 years ago

Sent from my Symphony

Dmitry notifications@github.com wrote:

@jsobers1331ItseemsthatyouareusingoldYii2version(maybebeta).Youshouldupdatetothelatestyii2version.ReplytothisemaildirectlyorviewitonGitHub.