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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:03:17+00:00 2026-05-24T06:03:17+00:00

I hope you can help me with this problem because I really cannot see

  • 0

I hope you can help me with this problem because I really cannot see what is wrong here.

I have 2 entities: RokZaPrijavuProjekta AND Predmet.

RokZaPrijavuProjekta:

/**
* @ORM\Table(name="rok_prijava_projekta")
* @ORM\Entity(repositoryClass="JP\AdminBundle\Repository\RokZaPrijavuProjektaRepository")
*/
class RokZaPrijavuProjekta
{
/**
 * @var integer $id
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var integer $id_predmet
 * @ORM\ManyToOne(targetEntity="Predmet")
 * @ORM\Column(name="id_predmet", type="integer")
 */
private $predmet;

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

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

/**
 * @var string $info
 * @ORM\Column(name="info", type="string", length=120)
 */
private $info;
}

Predmet entity code:

/**
 * @ORM\Table(name="predmeti")
 * @ORM\Entity(repositoryClass="JP\AdminBundle\Repository\PredmetRepository")
 */
class Predmet
{
/**
 * @var integer $id
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

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

/**
 * @var boolean $vidljiv
 * @ORM\Column(name="vidljiv", type="boolean")
 */
private $vidljiv;
}

Repository method:

$q = $this->createQueryBuilder('r')
->select('rzpp')
->where('rzpp.predmet = :predmet')
->from('JPAdminBundle:RokZaPrijavuProjekta', 'rzpp')
->leftJoin("rzpp.predmet", "p")
->setParameter('predmet', $predmet)
->getQuery();

Both getters and setters for all class members are defined properly.

Now, “RokZaPrijavuProjekta” has a foreign-key reference to “Predmet”, so many of these “RokZaPrijavuProjekta” can have the same “Predmet”.

I want to create unidirectional ManyToOne relation for this purpose but keep getting exception thrown:

Class JP\AdminBundle\Entity\RokZaPrijavuProjekta has no association named predmet

I went all over Doctrine documentation, but found that this is the preferred way to define unidirectional many-to-one relation.

Do you have any idea what might be a problem here?


UPDATE

  • Added Predmet entity code…
  • Added Repository method

Thanks a lot!

Regards,
Jovan

  • 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-24T06:03:19+00:00Added an answer on May 24, 2026 at 6:03 am

    Can you show Predmet entity code?

    Or just try out this code:

    // RokZaPrijavuProjekta
    /**
     * @ORM\ManyToOne(targetEntity="Predmet", inversedBy="rokzaprojects")
     */
    protected $predmet;
    
    
    //Predmet
    /**
     * @ORM\OneToMany(targetEntity="RokZaPrijavuProjekta", mappedBy="predmet")
     */
    protected $rokzaprojects;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope some of you guys can help me with this problem.... I have
I hope someone here can help me see where this error is coming from.
I really hope someone who is a CC.NET expert can help with this, because
I hope you can help. This has been confounding me for hours. I have
I hope there's a SharePoint expert here on SO who can help with this.
I'm new here and I hope anyonte can help me. I have WCF Service
hope you can help me with this: I'm working with j_security_check and have this
I hope someone can help me with this, as I'm unable to find the
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
I hope you can help me. I have a web service that needs to

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.