I create a model object as follows: $ object1 = new Object1 (); There is a table in the database named object1s. The Object1 class is an empty class that extends DataMapper. It works without a problem. I can save data and retrieve data from the database (I see this with a separate database client).
I tried to do the same with another object (and another table), for example $ object2 = new Object2 (); This time I get the following error message:
Fatal error: calling member () member function for non-object in /Applications/XAMPP/xamppfiles/htdocs/c/application/libraries/Datamapper.php on line 6049
Line 6049 is as follows:
return $ this-> lang-> line ($ key);
When I created an instance of Object1, at this moment $ this-> lang, an instance of DM_Lang was installed, but when creating an instance of the second object $ this-> lang it was set to "en". The only difference between the two is the name and table of the database.
What can I do to fix this? Why are they different? Where is $ this-> lang installed (I already went through the debugger and can't find it)?
The database is MySQL. I run this for development on MacOSX Lion. The web server is apache. I am using DataMapper ORM v1.8.2.
There was a comment requesting the exact code. This is the complete exact code that I tested with (I copied and pasted from each file).
Object1 is called Movie, models / movie.php:
<?php
class Movie extends DataMapper {
}
Object 2 is called Image, models / image.php:
<?php
class Image extends DataMapper {
}
The controller looks like this: controllers / test.php:
<?php
class Test extends CI_Controller {
public function newdata()
{
$movie = new Movie();
$image = new Image();
}
}
, DataMapper v1.8.2. index.php , CodeIgniter.
require_once APPPATH.'third_party/datamapper/bootstrap.php';
Movie. , SQL.
, "$ image =..." , "$ movie =..." . , , .
CI_VERSION = 2.1.0.
.