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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:56:17+00:00 2026-06-09T16:56:17+00:00

I am creating small application with just two entities, Order and Shipment. The Shipment

  • 0

I am creating small application with just two entities, Order and Shipment.

The Shipment entity is as follows: (methods removed to keep it short)

/**
 * @var integer $id
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var string $username
 *
 * @ORM\Column(name="username", type="string", length=255)
 */
private $username;

/**
 * @var string $password
 *
 * @ORM\Column(name="password", type="string", length=255)
 */
private $password;

/**
 * @var integer $order_id
 *
 * @ORM\Column(name="order_id", type="integer")
 */
private $order_id;

/**
 * @var smallint $payment_type
 *
 * @ORM\Column(name="payment_type", type="smallint")
 */
private $payment_type;

In my controller I am trying to query using the order_id but my findOneByOrderId method is not working.

$orderExists = $this->getDoctrine()
                ->getRepository('ShipBundle:Shipment')
                ->findOneByOrderId($orderId);

var_dump($orderExists);     die();

The error I get is:

Entity 'ShipBundle\Entity\Shipment' has no field 'orderId'. You can therefore not call 'findOneByOrderId' on the entities' repository.

If I am not wrong, Doctrine find methods join the variables at underscores and capitalize them. What am I doing wrong?

  • 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-09T16:56:18+00:00Added an answer on June 9, 2026 at 4:56 pm

    I managed to solve the problem with the hint from pomaxa and Doctrine2 documentation.

    The correct code would be:

    $orderExists = $this->getDoctrine()
                    ->getRepository('ShipBundle:Shipment')
                    ->findOneBy(array('order_id' => $orderId));
    

    explained at: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#by-simple-conditions

    Thanks everyone for the help. I appreciate it.

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

Sidebar

Related Questions

I am creating a small application which will perform say 4 different, time consuming
I am creating small django application which holds some few questions (and answers for
I'm creating a small vb.net application, and I'm trying trying to write a list
I have a small application where I am creating a customer [Authorize] [AcceptVerbs(HttpVerbs.Post)] public
I'm creating simple example on JSF. It's small Login application. My problem is duplicate
I am creating a small application with a JavaScript client (run in the browser)
I am creating a small application using HTML 5, Javascript and Google Maps API
I'm currently creating a small silverlight application for testing, to see if it can
I have a small doubt, so apologies first. I am creating an iPhone application
OK, i'm creating a small PHP application. The current structure is something like this:

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.