Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:06:19+00:00 2026-06-03T23:06:19+00:00

I am creating a model object like this: $object1 = new Object1(); There is

  • 0

I am creating a model object like this: $object1 = new Object1(); There is a table in the database named object1s. The Object1 class is an empty class that extends DataMapper. That works without problems. I am able to save data, and retrieve data from the database (I can see it using a separate database client).

I tried to same thing with another object (and a different table), for example, $object2 = new Object2(); This time I get the following error message:

Fatal error: Call to a member function line() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/c/application/libraries/Datamapper.php on line 6049

Line 6049 looks like this:

return $this->lang->line($key);

When I instantiated Object1, $this->lang was set to an instance of DM_Lang at this point, but when instantiating the second object $this->lang is set to “en”. The only difference between the two are the name and database table.

What can I do to fix this? Why are they different? Where is $this->lang being set (I’ve already stepped through with a debugger and can’t find it)?

The database is MySQL. I’m running this for development purposes on MacOSX Lion. The web server is apache. I’m using DataMapper ORM v1.8.2.


There was a comment requesting the exact code in question. This is the complete exact code 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()
    {
        // The following line runs as expected
        $movie = new Movie();
        // The following line fails with the Fatal error mentioned above
        $image = new Image();

    }

}

I followed the installation instructions that came with DataMapper v1.8.2. My index.php file includes the following before loading the CodeIgniter bootstrap file.

/* --------------------------------------------------------------------
 * LOAD THE DATAMAPPER BOOTSTRAP FILE
 * --------------------------------------------------------------------
 */
        require_once APPPATH.'third_party/datamapper/bootstrap.php';

It works quite smoothly with the Movie object. I am able to write data to it and verify it is there using a separate SQL query tool.

I just noticed that the “$image = …” line runs with no errors if the “$movie = …” line is commented out. I will, however, need both of them for my app to function properly.

I am using CI_VERSION=2.1.0.

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:06:21+00:00Added an answer on June 3, 2026 at 11:06 pm

    The database schema had been used prior to switching to CodeIgniter. The first table had a name conflict (it used “lang” for a field name). The second table had no conflicts, and was failing only because it was the next DataMapper subclass instantiation coming after the model object with the problem. My attention was on the table/model that was failing, when in reality it was the one that succeeded that had the problem.

    The fix was to check ALL model objects for conflicts, not just the one that is failing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a new database model using Entity Framework 4.3 Code-FIrst; using Fluent
I have a model like this defined... public class Product{ private long timestamp; //
The situation is something like this: PostgreSQL Database table has a field dateAdded which
I'm creating a data model using xcode and core data. It's an object graph,
I am creating a model binder to use with asp.net mvc. This is what
I am creating a model for users and I want that property joined was
I have a relationship in a Core Data model that feels like it wants
While creating new records. I need to create more records for the same model.
I have a method that will let me select the prototype object when creating
I am creating the domain model in my system. When designing my model objects,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.