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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:29:29+00:00 2026-06-05T16:29:29+00:00

I’m getting the following error when I try to do ./app/console doctrine:migrate:diff : [Doctrine\ORM\Mapping\MappingException]

  • 0

I’m getting the following error when I try to do ./app/console doctrine:migrate:diff:

 [Doctrine\ORM\Mapping\MappingException]                                        
  Class VNN\CoreBundle\Entity\Game is not a valid entity or mapped super class. 

Here’s the line that’s causing it:

/**
 * @ORM\ManyToOne(targetEntity="VNN\CoreBundle\Entity\Game")

Here’s the relevant part of my class:

<?php

namespace VNN\PressboxBundle\Entity;

use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Query\Expr\OrderBy;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Type;
use VNN\CoreBundle\Entity\Game;

/**
 * VNN\PressboxBundle\Entity\Event
 *
 * @ORM\Table(name="event")
 * @ORM\Entity
 */
class Event
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="VNN\CoreBundle\Entity\Game")
     * @ORM\JoinColumn(name="core_game_id", referencedColumnName="game_id")
     **/
    private $coreGame;

What I understand it’s saying is not that it can’t find VNN\CoreBundle\Entity\Game, just that Game is not a valid entity. So here’s Game.php:

<?php

namespace VNN\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * VNN\CoreBundle\Entity\Game
 *
 * @ORM\Table(name="games")
 * @ORM\Entity
 */
class Game
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="game_id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

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

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

    /**
     * @ORM\ManyToOne(targetEntity="School")
     * @ORM\JoinColumn(name="home_school_id", referencedColumnName="school_id")
     **/
    private $homeSchool;

    /**
     * @ORM\ManyToOne(targetEntity="School")
     * @ORM\JoinColumn(name="away_school_id", referencedColumnName="school_id")
     **/
    private $awaySchool;

    /**
     * @ORM\ManyToOne(targetEntity="Sport")
     * @ORM\JoinColumn(name="sport_id", referencedColumnName="sport_id")
     **/
    private $sport;

    /**
     * @var integer $datetime
     *
     * @ORM\Column(name="game_datetime")
     */
    private $datetime;

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

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

    public function getId()
    {
        return $this->id;
    }

    public function getHomeSchool()
    {
        if ($this->homeSchoolId > 0) {
            return $this->homeSchool;
        } else {
            return FALSE;
        }
    }

    public function getAwaySchool()
    {
        if ($this->awaySchoolId > 0) {
            return $this->awaySchool;
        } else {
            return FALSE;
        }
    }

    public function recordIsValid()
    {
        if (!($this->homeSchoolId > 0)) {
            return FALSE;
        }

        if (!($this->awaySchoolId > 0)) {
            return FALSE;
        }

        return TRUE;
    }

    public function getSport()
    {
        return $this->sport;
    }

    public function getHumanDatetime()
    {
        $date = new \DateTime($this->datetime);
        return $date->format('F d, Y g:ia');
    }

    public function getDatetime()
    {
        $date = new \DateTime($this->datetime);
        return $date->format('m/d/Y g:i:s a');
    }

    public function getOpposingSchoolWithRespectToSchoolName($schoolName)
    {
        if ($schoolName == $this->getHomeSchool()->getName()) {
            return $this->getAwaySchool();
        } else {
            return $this->getHomeSchool();
        }
    }

    public function getHomeScore()
    {
        return $this->homeScore;
    }

    public function getAwayScore()
    {
        return $this->awayScore;
    }
}

Why would it not like Game?

Update: I had this same exact problem again when I tried to do the same thing with another cross-bundle entity. I found this post, but the add-a-leading-slash fix didn’t do it for me like it evidently did for the OP there.

  • 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-05T16:29:32+00:00Added an answer on June 5, 2026 at 4:29 pm

    i’ve successfully used cross bundle entity relations without any problems. if you have automatic mapping disabled you need to tell doctrine each bundle that contains entities.

    so in app/config.yml you need to have either this:

    doctrine:
        orm:
            auto_mapping: true
    

    or this:

    doctrine:
        orm:
            auto_mapping: false
            entity_managers:
                default:
                    mappings:
                        VNNCoreBundle: ~
                        VNNPressboxBundle: ~
    

    check your database if tables for the bundles exist. also you could try running ./app/console doctrine:generate:entities --force and make sure it runs without errors

    edit

    i checked my code and the leading / is not necessary. also the use statement is superfluous.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.