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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:40:34+00:00 2026-05-26T07:40:34+00:00

I am using Zend and Doctrine to login using a table containing also a

  • 0

I am using Zend and Doctrine to login using a table containing also a foreign ID to another table. I need to get this ID in order to use it in a Doctrine query (through the controller) to the database like this:

$q = Doctrine_Query::create()
        ->from('Lost_Model_Item i')
        ->where('i.StatID = ?', 'I need the ID here') 
        $result = $q->fetchArray();

I have tried to get it like this:

Zend_Auth::getInstance()->getIdentity()->ID

But it seems to not work. I am new to Zend and a bit lost here. Could you please help?

As I ma working with doctrine I have created an adapter as follow:

public function authenticate()
   {
    $q = Doctrine_Query::create()
         ->from('Lost_Model_Station u')
      ->where('u.username = ? AND u.password = MD5(?)',
                array($this->username, $this->password)
      );
$result = $q->fetchArray();
if (count($result) == 1) {
  $this->_resultArray = $result[0];
  return new Zend_Auth_Result(
    Zend_Auth_Result::SUCCESS, $this->username, array());
} else {
  return new Zend_Auth_Result(
    Zend_Auth_Result::FAILURE, null, 
      array('Authentication unsuccessful')
  );      
}
  }
  • 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-26T07:40:35+00:00Added an answer on May 26, 2026 at 7:40 am

    How about using getIdentity to get the username and then use a sql join on Lost_Model_Item and Lost_Model_Station

    $q = Doctrine_Query::create()
        ->from('Lost_Model_Item i')
        ->leftJoin('i.Lost_Model_Station u')
        ->where('u.username = ?', Zend_Auth::getInstance()->getIdentity()) 
    $result = $q->fetchArray();
    

    This assumes that there is a doctrine “hasOne” relation defined for Lost_Model_Station (in the base class):

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('Lost_Model_Item', array(
             'local' => 'StatID',
             'foreign' => 'whatever_id_StatID_relates_to'));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: When should use doctrine ORM and when zend-db-table? In short, what is
I've been working with Zend Framework (using Doctrine as the ORM) for quite a
I am using Zend Framework(MVC part of it), and need to either redirect user
I'm using Zend Framework with Doctrine. I'm creating an object, editing, then saving it.
I'm using Doctrine with Zend Framework. For my model, I'm using a base class,
im using symfony with doctrine and zend. i wonder if i wanna validate the
I am processing a submitted Zend Form which updates a Doctrine Record using the
i am currently learning Zend Framework 1.10 and intend to use Doctrine 2. however
I'm using Doctrine 2 in a Zend Framework application and require functionality similar to
I am using Doctrine ORM for php and Zend MVC. I have a mysql

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.