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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:13:21+00:00 2026-05-31T05:13:21+00:00

I am developing an application using symfony2 and using orm.yml files for mapping the

  • 0

I am developing an application using symfony2 and using orm.yml files for mapping the entities into the database. The problem comes when trying to create the database tables for two entities that share a onetomany relationship (Anotatzea.php and Dokumentua.php). When running php app/console doctrine:schema:update --force it shows the next error

[RuntimeException]                                                                                                                                                                                                                                                                           
  The autoloader expected class "Anotatzailea\AnotatzaileaBundle\Entity\Anotatzea" to be defined in file "/var/www/Symfony/app/../src/Anotatzailea/AnotatzaileaBundle/Entity/Anotatzea.php". The file was found but the class was not in it, the class name or namespace probably has a typo. 

The entities have the following code:

<?php

namespace Anotatzailea\AnotatzaileaBundle\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Anotatzailea\AnotatzaileaBundle\Entity\Dokumentua
 *
 * @ORM\Table(name="Dokumentua")
 * @ORM\Entity
 */
class Dokumentua
{
    /**
     * @var integer $DokId
     *
     * @ORM\Column(name="DokId", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $DokId;

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

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

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

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

    /**
     * @ORM\OneToMany(targetEntity="Anotatzea", mappedBy="Dokumentua")
     */
    protected $Anotatzeak;

    /**
     * Get DokId
     *
     * @return integer 
     */
    public function getDokId()
    {
        return $this->DokId;
    }

    /**
     * Set Izenburua
     *
     * @param string $izenburua
     */
    public function setIzenburua($izenburua)
    {
        $this->Izenburua = $izenburua;
    }

    /**
     * Get Izenburua
     *
     * @return string 
     */
    public function getIzenburua()
    {
        return $this->Izenburua;
    }

    /**
     * Set Egilea
     *
     * @param string $egilea
     */
    public function setEgilea($egilea)
    {
        $this->Egilea = $egilea;
    }

    /**
     * Get Egilea
     *
     * @return string 
     */
    public function getEgilea()
    {
        return $this->Egilea;
    }

    /**
     * Set ErregistroData
     *
     * @param date $erregistroData
     */
    public function setErregistroData($erregistroData)
    {
        $this->ErregistroData = $erregistroData;
    }

    /**
     * Get ErregistroData
     *
     * @return date 
     */
    public function getErregistroData()
    {
        return $this->ErregistroData;
    }

    /**
     * Set DokEgoera
     *
     * @param boolean $dokEgoera
     */
    public function setDokEgoera($dokEgoera)
    {
        $this->DokEgoera = $dokEgoera;
    }

    /**
     * Get DokEgoera
     *
     * @return boolean 
     */
    public function getDokEgoera()
    {
        return $this->DokEgoera;
    }

    public function __construct()
    {
        $this->Anotatzeak = new ArrayCollection();
    }
}

<?php

namespace Anotatzailea\AnotatzaileaBundle\Anotatzea;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Anotatzailea\AnotatzaileaBundle\Entity\Anotatzea
 *
 * @ORM\Table(name="Anotatzea")
 * @ORM\Entity
 * @ORM\HasLifecycleCallbacks
 */
class Anotatzea
{
    /**
     * @var integer $AnotId
     *
     * @ORM\Column(name="AnotId", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $AnotId;

    /**
     * @ORM\ManyToOne(targetEntity="Dokumentua", inversedBy="Anotatzeak")
     * @ORM\JoinColumn(name="DokId", referencedColumnName="DokId")
     */
    protected $Dokumentua;

    /**
     * Get AnotId
     *
     * @return integer 
     */
    public function getAnotId()
    {
        return $this->AnotId;
    }

    /**
     * Set Dokumentua
     *
     * @param Anotatzailea\AnotatzaileaBundle\Entity\Dokumentua $dokumentua
     */
    public function setDokumentua(\Anotatzailea\AnotatzaileaBundle\Entity\Dokumentua $dokumentua)
    {
        $this->Dokumentua = $dokumentua;
    }

    /**
     * Get Dokumentua
     *
     * @return Anotatzailea\AnotatzaileaBundle\Entity\Dokumentua 
     */
    public function getDokumentua()
    {
        return $this->Dokumentua;
    }
    /**
     * @ORM\prePersist
     */
    public function setUpdatedValue()
    {
        // Add your code here
    }
}

And the orm.yml files:

Anotatzailea\AnotatzaileaBundle\Entity\Dokumentua:
  type: entity
  table: Dokumentua
  fields:
    DokId:
      type: integer
      id: true
      precision: 0
      scale: 0
      unique: false
      nullable: false
      generator:
        strategy: IDENTITY
    Izenburua:
      type: string
      length: 30
      precision: 0
      scale: 0
      unique: false
      nullable: false
    Egilea:
      type: string
      length: 40
      precision: 0
      scale: 0
      unique: false
      nullable: false
    ErregistroData:
      type: date
      precision: 0
      scale: 0
      unique: false
      nullable: false
    DokEgoera:
      type: boolean
      precision: 0
      scale: 0
      unique: false
      nullable: false
  OneToMany:
    Anotatzeak:
      targetEntity: Anotatzailea\AnotatzaileaBundle\Entity\Anotatzea
      cascade: {  }
      mappedBy: Dokumentua
      inversedBy: null
      orphanRemoval: false
      cascade: ["persist", "merge","remove"]
      orderBy: null
  lifecycleCallbacks: {  }

Anotatzailea\AnotatzaileaBundle\Entity\Anotatzea:
  type: entity
  table: Anotatzea
  fields:
    AnotId:
      type: integer
      id: true
      precision: 0
      scale: 0
      unique: false
      nullable: false
      generator:
        strategy: IDENTITY
  manyToOne:
    Dokumentua:
      targetEntity: Anotatzailea\AnotatzaileaBundle\Entity\Dokumentua
      cascade: {  }
      mappedBy: null
      inversedBy: Anotatzeak
      joinColumns:
        DokId:
          referencedColumnName: DokId
      orphanRemoval: false
  lifecycleCallbacks: { }
  • 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-31T05:13:21+00:00Added an answer on May 31, 2026 at 5:13 am

    The namespace name in the second entity file is wrong.

    Replace:

    namespace Anotatzailea\AnotatzaileaBundle\Anotatzea;
    

    with:

    namespace Anotatzailea\AnotatzaileaBundle\Entity;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application using Symfony2. The problem comes when creating a registration
Been developing an application using PHP's PEAR framework, but ran into an issue where
I am developing an application using asp.net 2.0 (C#), in which I am trying
i'm developing an application using Wicket as the view layer and JPA(Hibernate) as ORM.
I'm developing a little application using Symfony2. I can access all routes with no
I am developing an application using Symfony 1.4. Is it posible to disable a
Currently developing an application using the newest version of symfony, obtained through PEAR. This
I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my
I am developing an application using MVC Preview 5. I have used typed views.
I am developing an application using Windows Mobile 5.0, under embedded VC++ 4.0, and

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.