Yii Framework Forum: Problem CConsoleCommand - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem CConsoleCommand Error

#1 User is offline   Chall 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-January 16

Posted 21 January 2016 - 12:07 PM

Hello evry body I need some help please:
I need to create a crontab command but i have a big problem :
in commands
<?php
class CronTestCommand extends CConsoleCommand{


public function actionImporter()
{


$connection=Yii::app()->dbtest;

$model = new User();
var_dump($model);

}
}

then in config/console.php

'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.test.models.*',
'application.modules.test.components.*',

),
......


but always i have this problem



PHP Error[2]: include(/var/www/lde_socle/protected/modules/test/modules/test/models/_base/BaseUser.php): failed to open stream: No such file or directory
in file /var/www/Yii/framework/YiiBase.php at line 404
#0 /var/www/Yii/framework/YiiBase.php(404): autoload()
#1 unknown(0): autoload()
#2 /var/www/lde_socle/protected/modules/test/models/Test.php(23): spl_autoload_call()
#3 /var/www/Yii/framework/YiiBase.php(432): include()
#4 unknown(0): autoload()
#5 /var/www/lde_socle/protected/modules/administration/commands/CronTestCommand.php(15): spl_autoload_call()
#6 unknown(0): CronTestCommand->actionImporter()
#7 /var/www/Yii/framework/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs()
#8 /var/www/Yii/framework/console/CConsoleCommandRunner.php(71): CronTestCommand->run()
#9 /var/www/Yii/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run()
#10 /var/www/Yii/framework/base/CApplication.php(184): CConsoleApplication->processRequest()
#11 /var/www/Yii/framework/yiic.php(33): CConsoleApplication->run()
#12 /var/www/lde_socle/protected/modules/administration/yiic.php(36): require_once()


Any Help

Thank you !
0

#2 User is offline   Muaid 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 138
  • Joined: 25-October 10
  • Location:Saudi Arabia

Posted 25 January 2016 - 01:35 AM

Hi Chall

did you add:

Yii::import('application.modules.test.models._base.BaseUser');


in top of User.php file ?
0

#3 User is offline   Muaid 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 138
  • Joined: 25-October 10
  • Location:Saudi Arabia

Posted 25 January 2016 - 01:40 AM

you can type in Arabic freely in this forum to make it more informative for Arabic readers.

NOTE: i removed your other duplicate topic.

thank you.
0

#4 User is offline   Chall 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-January 16

Posted 25 January 2016 - 04:42 AM

Hello,

Yes i have this import in my class User.php

I can't write in arabic because i didn't have a keyboard arabic i am so sorry
0

#5 User is offline   Muaid 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 138
  • Joined: 25-October 10
  • Location:Saudi Arabia

Posted 25 January 2016 - 05:00 AM

your issue is simple but i cannot figure it out since i does not have the code, basically your issue in duplicated path:

/var/www/lde_socle/protected/modules/test/modules/test/models/_base/BaseUser.php

ill try to simulate your code in order to find the problem.
0

#6 User is offline   Chall 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-January 16

Posted 25 January 2016 - 05:38 AM

thank you i find the solution it just in config/main.php import this one 'ext.giix.components.*', :)

thank you !
0

#7 User is offline   Muaid 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 138
  • Joined: 25-October 10
  • Location:Saudi Arabia

Posted 25 January 2016 - 08:29 AM

as i expected, import issue :)

thanks for posting the solution so i stop trying ;)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users