(Frapi API) How to get Frapi_Database::getInstance() without class or function(Outside MAMP and FRAPI Environment)?

StackOverflow https://stackoverflow.com/questions/17548918

문제

I am setting up cron job in mac using crontab command.

I am using MAMP PRO as a local server environment for FRAPI API.

But I can not get Frapi_Database::getInstance() without using class or function in my simple PHP Script...

Actually function for getting database instance is as below :

 public function __construct()
 {
     $this->dbLink = Frapi_Database::getInstance();
 }

But I want to get database instance without using this method from Library,not from Action. How can I do this?

도움이 되었습니까?

해결책

I also had same problem.Include this file into your Cron file:

/src/frapi/library/Frapi/AllFiles.php from Frapi API.

It has All necessary file like Libraries,database,adaptor files,etc.

Also If you getwarning like "PHP Notice: Undefined index HTTP_HOST" in internal.php file then replace

$_SERVER with getenv

You will get rid out of this.

다른 팁

You can do it directly by invoking the static method

$connection = Frapi_Database::getInstance();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top