Bad server confiruration, or bad initialization?

173 views
Skip to first unread message

Bc. Petr Jonas

unread,
Jan 11, 2012, 3:05:47 AM1/11/12
to NotORM
Hi,

my trouble with NotORM is next:

on my local server is ok, but specific hosting on initialization and get simple data is answer:

Fatal error: Call to a member function getPrimary() on a non-object in /var/www/virtual/propet-pc.cz/beta/htdocs/vendor/notorm/NotORM/Result.php on line 21

initialization setup is:

$server = 'localhost';
$dbname = 'dbname';
$username = 'user';
$password = 'Pass';

$pdo = new PDO('mysql:host='.htmlspecialchars($server).';dbname='.htmlspecialchars($dbname) , htmlspecialchars($username), htmlspecialchars($password));
//$pdo = new PDO('mysql:host='.htmlspecialchars("localhost")).';dbname='.htmlspecialchars(trim("webpage")) , htmlspecialchars(trim("web")), htmlspecialchars(trim("webpage")));
$pdo->exec("set names utf8");
$pdo->query('select * from page');

$db = new NotORM($pdo);
$item = $db->page[0];

on last line get this error?

is possible enought configuration?

Thanx�� Petr




Д П

unread,
Jul 10, 2012, 5:23:18 AM7/10/12
to not...@googlegroups.com
HI, Petr!

Do you solve this problem? I have the same issue:

Notice: Undefined property: NotORM::$structure in .../Result.php on line 22

Fatal error: Call to a member function getPrimary() on a non-object in .../NotORM/Result.php on line 22

среда, 11 января 2012 г., 12:05:47 UTC+4 пользователь Petr Jonas написал:

Jakub Vrana

unread,
Dec 21, 2013, 9:48:25 AM12/21/13
to not...@googlegroups.com
Hi,

I couldn't reproduce it and I have no idea what could go wrong.

Jakub

On 07/10/2012 02:23 AM, Д П wrote:
> HI, Petr!
>
> Do you solve this problem? I have the same issue:
>
> *Notice*: Undefined property: NotORM::$structure in *.../Result.php* on
> line *22*
>
> *Fatal error*: Call to a member function getPrimary() on a non-object in
> *.../NotORM/Result.php* on line *22*
>
> среда, 11 января 2012 г., 12:05:47 UTC+4 пользователь Petr Jonas написал:
>
> Hi,
>
> my trouble with NotORM is next:
>
> on my local server is ok, but specific hosting on initialization and
> get simple data is answer:
>
> *Fatal error*: Call to a member function getPrimary() on a
> non-object in
> */var/www/virtual/propet-pc.cz/beta/htdocs/vendor/notorm/NotORM/Result.php
> <http://propet-pc.cz/beta/htdocs/vendor/notorm/NotORM/Result.php>*
> on line *21
>
> *initialization setup is:
>
> $server = 'localhost';
> $dbname = 'dbname';
> $username = 'user';
> $password = 'Pass';
>
> $pdo = new
> PDO('mysql:host='.htmlspecialchars($server).';dbname='.htmlspecialchars($dbname)
> , htmlspecialchars($username), htmlspecialchars($password));
> //$pdo = new
> PDO('mysql:host='.htmlspecialchars("localhost")).';dbname='.htmlspecialchars(trim("webpage"))
> , htmlspecialchars(trim("web")), htmlspecialchars(trim("webpage")));
> $pdo->exec("set names utf8");
> $pdo->query('select * from page');
>
> $db = new NotORM($pdo);
> $item = $db->page[0];*
> **
> *on last line get this error?
>
> is possible enought configuration?
>
> Thanx�� Petr
> ***
>
> *
> *
> *
>

Jakob Knigga

unread,
Jun 30, 2014, 1:50:03 PM6/30/14
to not...@googlegroups.com
I am having the same issue.

Jakob

Hari K T

unread,
Jun 30, 2014, 9:56:12 PM6/30/14
to not...@googlegroups.com
Hey,

my trouble with NotORM is next:

on my local server is ok, but specific hosting on initialization and get simple data is answer:

Fatal error: Call to a member function getPrimary() on a non-object in /var/www/virtual/propet-pc.cz/beta/htdocs/vendor/notorm/NotORM/Result.php on line 21

initialization setup is:

$server = 'localhost';
$dbname = 'dbname';
$username = 'user';
$password = 'Pass';

$pdo = new PDO('mysql:host='.htmlspecialchars($server).';dbname='.htmlspecialchars($dbname) , htmlspecialchars($username), htmlspecialchars($password));
//$pdo = new PDO('mysql:host='.htmlspecialchars("localhost")).';dbname='.htmlspecialchars(trim("webpage")) , htmlspecialchars(trim("web")), htmlspecialchars(trim("webpage")));
$pdo->exec("set names utf8");
$pdo->query('select * from page');

$db = new NotORM($pdo);
$item = $db->page[0];

From the http://www.notorm.com/ example .

$application = $db->application[1]; // get by primary key

So in your case $db->page[0] is trying to fetch the column with primary key 0.

Probably give the primary key which is already there. Else my assumption is the primary column name is not id. It may be a different name.
 

on last line get this error?

is possible enought configuration?

Thanx�� Petr


Hari K T

You can ring me : +91 9388 75 8821

Skype  : kthari85
Twitter : harikt

Jakob Knigga

unread,
Jul 1, 2014, 8:22:09 AM7/1/14
to not...@googlegroups.com
Hari,

I was thinking that in my case it could be something with the table structure but I downloaded the tutorial files and tried to use those tables but I am still getting the error.

I am using PHP 5.1.6 if that matters.

Jakob

Hari K T

unread,
Jul 1, 2014, 8:28:28 AM7/1/14
to not...@googlegroups.com
Sorry I can't be much helpful here :( .

Hari K T

You can ring me : +91 9388 75 8821

Skype  : kthari85
Twitter : harikt


--
You received this message because you are subscribed to the Google Groups "NotORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notorm+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jakob Knigga

unread,
Jul 1, 2014, 8:34:37 AM7/1/14
to not...@googlegroups.com
No worries, I appreciate the help! Still wish I knew what was going on! :)

Jakob

Allysson David

unread,
Jul 1, 2014, 4:59:19 PM7/1/14
to not...@googlegroups.com
Hello, I can at least identify where your error is supposed to be originating from:


Fatal error: Call to a member function getPrimary() on a non-object in /var/www/virtual/propet-pc.cz/beta/htdocs/vendor/notorm/NotORM/Result.php on line 21

This tell us that the error should be on the following line (NotORM/Result.php @ Line 23*):
$this->primary = $notORM->structure->getPrimary($table); Which means that $notORM->structure is NULL.

Since you initialized as this:
$db = new NotORM($pdo);

By default your call were supposed to have triggered this (NotORM.php @ Line 59*):
if (!isset($structure)) {
$structure = new NotORM_Structure_Convention;
}
$this->structure = $structure;

But you must have some error on those steps...

*Line numbers refer to latest version from GitHub, yours probably doesn't include the AND & OR comments on top added around Feb. 2014, but code at NotORM for $structure seems to be there since 2010... so you must have that too...

Worst is, you get the error because $item = $db->page[0]; is calling:
function __get($table) {
return new NotORM_Result($this->structure->getReferencingTable($table, ''), $this, true);
}

And that is the object that is generating the error. But as stated before the error comes from 
$this->structure being NULL in the $this (2nd arg) in this call, and at the same time $this->structure is being used on the first call and isn't causing an error. This is confusing as hell, do you follow?

Try downloading a fresher version of NotORM, will you?

Allysson David

unread,
Jul 1, 2014, 5:03:20 PM7/1/14
to not...@googlegroups.com
Amend:
... and at the same time $this->structure is being used on that call to getReferencingTable on the first arg and isn't causing an error ...


2014-07-01 17:58 GMT-03:00 Allysson David <v1.7...@gmail.com>:
...


And that is the object that is generating the error. But as stated before the error comes from 
$this->structure being NULL in the $this (2nd arg) in this call, and at the same time $this->structure is being used on the first call and isn't causing an error. This is confusing as hell, do you follow?  
 
...

Vasilij Sviridov

unread,
Oct 30, 2014, 2:49:58 AM10/30/14
to not...@googlegroups.com
Hello,

Same problem here, thought that eAccelerate causing this.
Reply all
Reply to author
Forward
0 new messages