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 1080521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:02:52+00:00 2026-05-16T22:02:52+00:00

I’m currently using Doctrine 1.2.2 with MySQL on the backend. When I attempt to

  • 0

I’m currently using Doctrine 1.2.2 with MySQL on the backend. When I attempt to retrieve a result set for more than one item using the record or lazy load hydration modes, only a single item shows up. However, when I use the array hydration mode, I see all of the results. Consistently, only the last item in the result set is retrieved.

Did I misunderstand the API? Is the model defined incorrectly (it was autogenerated). Shouldn’t it be this simple?

Right now, I’m firing up my debugger and I will be stepping through Doctrine’s source code.

// Model used:

<?php

/**
 * BaseEntryVote
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property integer $contest_id
 * @property integer $vote_id
 * @property integer $entry_id
 * @property integer $subcategory_id
 * @property string $company
 * @property string $website
 * @property string $email
 * @property string $comments
 * @property integer $votes
 * 
 * @package    ##PACKAGE##
 * @subpackage ##SUBPACKAGE##
 * @author     ##NAME## <##EMAIL##>
 * @version    SVN: $Id: $
 */
abstract class BaseEntryVote extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('entry_vote');
        $this->hasColumn('contest_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => true,
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('vote_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => true,
             'autoincrement' => false,
             ));
        $this->hasColumn('entry_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'default' => '0',
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('subcategory_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'default' => '0',
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('company', 'string', 100, array(
             'type' => 'string',
             'length' => 100,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('website', 'string', 75, array(
             'type' => 'string',
             'length' => 75,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('email', 'string', 75, array(
             'type' => 'string',
             'length' => 75,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('comments', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => false,
             'autoincrement' => false,
             ));
        $this->hasColumn('votes', 'integer', 4, array(
             'type' => 'integer',
             'length' => 4,
             'fixed' => false,
             'unsigned' => false,
             'primary' => false,
             'notnull' => false,
             'autoincrement' => false,
             ));
    }

    public function setUp()
    {
        parent::setUp();

    }
}


// Below is the code used to access the doctrine api

/*
Table entry_vote
================
contest_id, vote_id, entry_id, subcategory_id, company, website, email, comments, votes
----------------
contest_id   INT
vote_id      INT
entry_id     INT
subcategory_id INT
company      VARCHAR
website      VARCHAR
email        VARCHAR
comments     VARCHAR
votes        INT

Data in db:
'0', '1', '1', '0', 'Foo Bank', 'http://localhost/foo', 'bob@foo.com', NULL, '2'
'0', '0', '0', '0', 'TPS Corp', 'http://localhost/tps', 'bob@tps.com', NULL, '1'
*/

$result = Doctrine_Core::getTable('EntryVote')->findAll();

foreach ($result as $entry) {
   print $entry->company;
}

/* Here is the query that Doctrine is generating: */
SELECT e.contest_id AS e__contest_id, e.vote_id AS e__vote_id, 
e.entry_id AS e__entry_id, e.subcategory_id AS e__subcategory_id,
e.company AS e__company, e.website AS e__website,
e.email AS e__email, e.comments AS e__comments, e.votes AS e__votes
FROM entry_vote e WHERE (e.contest_id = ?)
  • 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-16T22:02:53+00:00Added an answer on May 16, 2026 at 10:02 pm

    Thanks to the nice folks on the #doctrine irc channel, I have this working now.

    The source of the problem was that I did not have auto-increment set on the primary key of the vote table. So, if you are having similar problems, make sure that whatever column that you choose to have as your primary key in your model also has the auto-increment bit set in the database schema.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and

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.