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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:15:43+00:00 2026-06-14T08:15:43+00:00

I’m using Inheritance with Doctrine 2.1 : Fiche is the master entity and Artist

  • 0

I’m using Inheritance with Doctrine 2.1 :

Fiche is the master entity
and Artist is derived from Fiche

so : Fiche -> Artist

then I have this method, in another repository called Abonnement :

public function getCountAbonnes(\MyApp\FicheBundle\Entity\Fiche $fiche){

    $qb = $this->_em->createQueryBuilder();

    $qb->add('select', $qb->expr()->count('abonnement'));
    $qb->from('\Teelt\FicheBundle\Entity\Abonnement', 'abonnement');

    // !!!! this line is the problem !!!!
    $qb->where('fiche', $fiche);

    return $qb->getQuery()->getSingleScalarResult();
}

Here’s the Abonnement ORM definition :

MyApp\FicheBundle\Entity\Abonnement:
    type: entity
    repositoryClass: MyApp\FicheBundle\Repository\AbonnementRepository
    table: abonnement

    # many fiche for many users
    manyToOne:
      user:
        targetEntity: MyApp\UserBundle\Entity\User
        inversedBy: abonnements
      fiche:
        targetEntity: MyApp\FicheBundle\Entity\Fiche
        inversedBy: abonnements

# etc ...

The problem I have here is that I always pass the Artist entity instead of the Fiche, and I get this error :

Expression of type ‘Teelt\FicheBundle\Entity\Artist’ not allowed in this context.

So I guess I must fetch the Fiche from my Artist … which sounds bad since it’s the same object !

  • 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-14T08:15:43+00:00Added an answer on June 14, 2026 at 8:15 am

    Thanks for your answer, it got me closer to the solution,

    but at the end it seems that :

    $qb->where($qb->expr()->eq('abonnement.fiche', $fiche->getId() ));
    

    was the solution.

    Is it normal ? I thought that the mapping of the ID would be automatic, but if I don’t use the getId() It returns a toString() version of my Fiche and generate an :

    SELECT COUNT(abonnement) FROM MyAppFicheBundle:Abonnement abonnement
    WHERE abonnement.fiche = Miles Davis

    [Syntax Error] line 0, col 100: Error: Expected end of string, got ‘Davis’

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I have thousands of HTML files to process using Groovy/Java and I need 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.