I am learning how to create console application with Yii 2.0. I have downloaded the Yii advanced package 2.0 which already has the default console application in it. I have copied that console application and pasted in my project. In that console application I have a TestController and an actionIndex() method, very basic following the documentation of Yii 2.0. When I run the command within my project:
php yii test
I've got the following error:
Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\Request::enableCookieValidation'
When I run the same command in the downloaded Yii advanced application. It works fine. I don't know what causes the error in my project and where to check it. Does anyone have a clue? If you ask how my console application look like, it is literally copied from the Yii 2.0 advanced application. If I run:
php yii migrate
I get the same error.
Seems like you having this line in your console application config:
'request' => [
'enableCookieValidation' => ...
],
You should delete it because yii\console\Request compared to yii\web\Request simply doesn't have that property.
Rememeber that in Yii advanced template, there are three settings instances; common/config is the first instance, after that , many of these properties override
Related
I'm trying to generate a front-end for my symfony app building with API - platform follow the documentation on this page:
https://api-platform.com/docs/client-generator/react/
However, this does not seem to work. I received "cannot find module lodash" when ran this command,
$ npx #api-platform/client-generator https://demo.api-platform.com src/ --resource book
I have also tried with API Platform distribution (as advised in the documentation) but it does not work. I received the same error message regarding "lodash" module.
Any advice would be appreciated.
I set up the INVO project of Phalcon to get used to the framework. However, I'm facing a problem with the register process. When I try to register, I get the error
Catchable fatal error: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Email given in C:\xampp\htdocs\invo\app\models\Users.php on line 13
I haven't changed anything code-wise and I searched Google for a solution to this, but I haven't found anything. Any ideas on how to solve this issue?
You are using Phalcon 2.1 beta but INVO uses stable 2.0
yiic webapp D:\wamp\www\test
sh.exe": yiic: command not found
yii webapp D:\wamp\www\test
Error: Unknown command "webapp".
You don't need yiic for installing Yii2 see the getting started guide for all the information you need . You can install really easly with composer
http://www.yiiframework.com/doc-2.0/guide-start-installation.html
Use init command in yii2
C:\xampp\htdocs\advanced>init
Yii Application Initialization Tool v1.0
Which environment do you want the application to be initialized in?
[0] Development
[1] Production
Your choice [0-1, or "q" to quit]
I am developing a Laravel Application and I created a custom class named Date. This class was placed in app/libraries/date.php. In the file app/start/global.php I put the following line:
app_path().'/libraries',
On my localhost server all works, but on my remote server all works also except pages which use this class.
The following error is displayed:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)
Class 'Date' not found
Important: I don't have SSH access to my server. The deploy was taken manually, uploading the files via FTP.
Laravel without SSH access is not quite possible as you need composer. If you have some sort of composer manager you should dump it's autoload. But...
What you're doing is awfully bad practice!
Custom classes should be developed using workbench for beginners or manually by advanced coders in the central /vendor or /workbench locations and nowhere else. You should take a look at Laravel's documentation on how to develop a package: Laravel documentation - Package development
Recently I've discovered Yii framework and started learning it. I've generated app skeleton using yiic tool, installed PHPUnit, SeleniumRC and attempted to run functional tests provided by skeleton app (I didn't change anything).
> phpunit functional/SiteTest.php
Report said following:
There was 1 error:
1) SiteTest::testLoginLogout
PHPUnit_Framework_Exception: Response from Selenium RC server for testComplete().
ERROR: Element link=Logout not found.
I found that there was a 'Logout (demo)' link, not just 'Logout'. If I change php code in testcase, all tests pass ok. Is it error of Yii developers or am I missing something?
Yii 1.1.6 fixes this bug.
if($this->isTextPresent('Logout'))
$this->clickAndWait('link=Logout');