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

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

Question

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?

Était-ce utile?

La solution

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.

Autres conseils

You can do it directly by invoking the static method

$connection = Frapi_Database::getInstance();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top