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

  • Home
  • SEARCH
  • 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 309141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:42:53+00:00 2026-05-12T07:42:53+00:00

I started to build a POS system in Doctrine. I am getting an order,

  • 0

I started to build a POS system in Doctrine. I am getting an order, but I have no clue whether or not I even set up subclasses in the proper way for Doctrine.

Here is the model I came up with for line items on an order

lineItem: line_total, order_id, type
rentLineItem: returned_date_time, item_id, sold
buyLineItem: item_id

The database looks like that. Type is either a 1 (rent) or a 2 (buy)

Here is the lineItem class

class lineItem extends Doctrine_Record
{
  public function setTableDefinition()
  {
    $this->hasColumn('line_total','int');
    $this->hasColumn('order_id','int');

    $this->setSubclasses(array(
        'rentLineItem' => array('type' => 1),
        'buyLineItem' => array('type' => 2),
      )
    );
  }

  public function setUp()
  {
    $this->hasOne('order', array('local' => 'order_id', 'foreign' => 'id'));
  }
}

Here is the rentLineItem class (buyLineItem looks similar)

class rentLineItem extends lineItem
{
  public function setTableDefinition()
  {
    $this->hasColumn('returned_date_time','datetime');
    $this->hasColumn('sold','tinyint', 2); // just in case it is sold at the end of the rental
    $this->hasColumn('item_id','int');
  }

  public function setUp()
  {
    $this->hasOne('item', array('local' => 'item_id', 'foreign' => 'id'));
}
}

Here is the code I have calling the objects

$q = Doctrine_Query::create()
->select('*')
->from('order')
->where('DATE(creation_date_time) = \'' . $theDate . '\'');

$orders = $q->execute();

$totalRents = 0;
$totalSales = 0;

foreach ($orders as $order) {
  foreach ($order->line_items as $lineItem) {
    if ($lineItem->type == 1) {
      $totalRents++;
    } else if ($lineItem->type == 2) {
      $totalSales++;
    }
  }
}

Here is the error I am getting

Fatal error: Uncaught exception 'Doctrine_Record_UnknownPropertyException' with message 'Unknown record property / related component "type" on "lineItem"' in 
/Developer/Projects/VEL/lib/vendor/doctrine/Doctrine/Record/Filter/Standard.php:55 Stack trace: #0 
/Developer/Projects/VEL/lib/vendor/doctrine/Doctrine/Record.php(1296): Doctrine_Record_Filter_Standard->filterGet(Object(lLineItem), 'type') #1 
/Developer/Projects/VEL/lib/vendor/doctrine/Doctrine/Record.php(1255): Doctrine_Record->_get('type', true) #2 
/Developer/Projects/VEL/lib/vendor/doctrine/Doctrine/Access.php(72): Doctrine_Record->get('type') #3 
/Developer/Projects/VEL/manage/manage/dailyincomeexpensereport.php(29): Doctrine_Access->__get('type') #4 {main} thrown in 
/Developer/Projects/VEL/lib/vendor/doctrine/Doctrine/Record/Filter/Standard.php on line 55
  • 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-05-12T07:42:53+00:00Added an answer on May 12, 2026 at 7:42 am

    Add a $this->hasColumn(‘type’,’int’); above your subclass call. You have to declare the column first before you use it for subclassing.

    Also, in your subclass setTableDefinition calls, add a parent::setTableDefinition(); statement at the top. Also do the same with the setUp() methods. It may or may not solve your problem, but that may cause problems in the future. As for what you’re referring to, when Doctrine hydrates the relationship collections, the last time I used column aggregation inheritance it did the same thing to me…It may simply not be supported unless you’re querying directly.

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

Sidebar

Related Questions

This build warning just started showing up. I'm building for 3.1.3. Not sure what
I've started experimenting with Hudson as a build server. I'm using subversion and have
I'm getting started with Titanium Studio to build mobile apps. I'm using Beanstalkapp (or
Im looking to build a thread manager for an application. I have already started
I just started using CCNet, and in the process of getting my build projects
Iv'e just started a new Wordpress blog and I have started to build the
I have started to build my own apps on iPhone and iPad using the
I have started to build a blog engine which is totally unprofesional and meant
I'm trying to build Truecrypt 7.0 I have build the driver. But I can't
I've just recently started to build a web site using ASP.NET - MVC 4,

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.