Propel(PHP ORM),基本用法为所有(非空)表和列返回NULL

Propel(PHP ORM),基本用法为所有(非空)表和列返回NULL

问题描述:

I am using Propel ORM and I set everything that must be from Propel Documentation. I have tables and when i echo the result from some Table row the result is just NULL, and NULL for everything. Of course these tables/rows are not empty. It works fine with standart query. The problem is that there are not errors, too and thats why i can't find the solution and I can'tt explain the problem, like I want. I am new with Propel and want to use it. Please, if there is someone with expirience to help me. I am using MySQL. The code is just standart:

 // setup the autoloading
 require_once '../vendor/autoload.php';

 // setup Propel
 require_once '../vendor/bin/generated-conf/config.php';

 $author = new Authors();

 echo '<pre>';
 var_dump($author);
 echo '</pre>';

The table is not empty.

http://propelorm.org/Propel/documentation/08-logging.html

You will more info about errors from logs.

$author = new Authors();

Is not retrieving all of the rows in Authors (is the table named author or authors?). For that, you need to use a query:

$q = \AuthorsQuery::create();
$authors = $q->find();
foreach ($authors as $author) {
    var_dump($author->toArray());
}