I want to make a module in feng installation. For now, I want to list the documents stored in the database, but using the API (classes) of Feng. I added a PHP page in the root of the installation and tried to make import classes to use APIs Feng. I don't know what class to import. This is the PHP file contents:
<?php
define('ROOT', dirname(__FILE__));
$config_is_set = @include_once(ROOT . '/config/config.php');
if(!is_bool($config_is_set) || !$config_is_set) {
header("Location: public/install");
die();
} // if
require ROOT . '/environment/classes/AutoLoader.class.php';
@include ROOT . '/cache/autoloader.php';
require ROOT . '/application/functions.php';
require ROOT . '/environment/functions/general.php';
DB::connect(DB_ADAPTER, array(
'host' => DB_HOST,
'user' => DB_USER,
'pass' => DB_PASS,
'name' => DB_NAME,
'persist' => DB_PERSIST
)); // connect
if(defined('DB_CHARSET') && trim(DB_CHARSET)) {
DB::execute("SET NAMES ?", DB_CHARSET);
} // if
$id = "95";
$file = ProjectFiles::findById($id);
if($file instanceof ProjectFile) {
echo "FILENAME: " . $file->getFilename();
echo ", CONTENT:: " . $file->getFileContent();
echo ", NUMBER:: " . $file->getRevisionNumber();
$revision = $file->getLastRevision();
if($revision instanceof ProjectFileRevision){
echo ", COMMENT:: " . $revision->getComment();
}else{
echo ", ELSE";
}
echo ", ID REVISION: ".$revision->getId();
}
?>
Result:
FILENAME: Documento.html
[(95)
], CONTENT::
[(95)
], NUMBER:: 0
[(95)
], ELSE
Fatal error: Call to a membr function getId() on a non-object in C:\xampp\htdocs\oficina\zohosave.php on line 37
The object ProjectFile is ok but object ProjectFileRevision is null. I referred in the file_details method of FileController.class.php
Can you help me?
Sincerely,
William