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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:05:21+00:00 2026-06-13T12:05:21+00:00

not sure where I am going wrong on this. Been new to Doctrine, its

  • 0

not sure where I am going wrong on this. Been new to Doctrine, its probably something simple.

Am trying to save a new registered user to the Account table and then create an entry in the related Profile table and then store the Profile id in the Accounts profile_id field.

The error I am getting is

Application error
Exception information:

Message: Class does not exist
Stack trace:

#0 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/Mapping/ClassMetadata.php(67): ReflectionClass->__construct('')
#1 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/Mapping/ClassMetadataFactory.php(350): Doctrine\ORM\Mapping\ClassMetadata->__construct(false)
#2 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/Mapping/ClassMetadataFactory.php(260): Doctrine\ORM\Mapping\ClassMetadataFactory->newClassMetadataInstance(false)
#3 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/Mapping/ClassMetadataFactory.php(169): Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata(false)
#4 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/EntityManager.php(247): Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor(false)
#5 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/UnitOfWork.php(1222): Doctrine\ORM\EntityManager->getClassMetadata(false)
#6 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/UnitOfWork.php(1678): Doctrine\ORM\UnitOfWork->doPersist(1, Array)
#7 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/UnitOfWork.php(1252): Doctrine\ORM\UnitOfWork->cascadePersist(Object(GDS\Entity\Profile), Array)
#8 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/UnitOfWork.php(1201): Doctrine\ORM\UnitOfWork->doPersist(Object(GDS\Entity\Profile), Array)
#9 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Doctrine/ORM/EntityManager.php(454): Doctrine\ORM\UnitOfWork->persist(Object(GDS\Entity\Profile))
#10 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/application/controllers/MemberinfoController.php(81): Doctrine\ORM\EntityManager->persist(Object(GDS\Entity\Profile))
#11 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Zend/Controller/Action.php(516): MemberinfoController->registerAction()
#12 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('registerAction')
#13 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#14 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#15 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#16 /Library/Server/Web/Data/Sites/euphoriagaming/public_html/public/index.php(25): Zend_Application->run()
#17 {main}  

registerAction within the controller

if ($form->isValid($this->_request->getPost()))
        {   // Valid input
            $username = $this->getRequest()->getParam('username');
            $email = $this->getRequest()->getParam('email');
            $emailconfirm  = $this->getRequest()->getParam('emailconfirm');
            $password = $this->getRequest()->getParam('password');
            $passwordconfirm  = $this->getRequest()->getParam('passwordconfirm');


            $pwdMD5 = md5($password);
            $emailValidateString = md5($username);

            $em = $this->entityManager;

            $account = new GDS\Entity\Account;

            $account->setUsername($username);
            $account->setEmailaddress($email);
            $account->setPassword($pwdMD5);
            $account->setValidationstring($emailValidateString);
            $account->setAccountvalidated(false);

            $em->persist($account);
            $em->flush();

            $accounts = $account = $em->getRepository('GDS\Entity\Account')
                ->findOneBy(array('emailaddress' => $email));

            // Set up initial profile db entry
            $accountProfile = new GDS\Entity\Profile;
            $accountProfile->setAccountId($accounts->getId());

            $em->persist($accountProfile);
            $em->flush();

            $accountProfileDbEntry = $em->getRepository('GDS\Entity\Profile')
                                ->findOneBy(array('AccountId' => $accounts->getId()));

            $ProfileId = $accountProfileDbEntry->getId();

            // Update the Account table entry with the profile Id
            $account->setProfileId($ProfileId);
            $em->persist($account);
            $em->flush();
        }

Account Entity

namespace GDS\Entity;
/**
 * @Entity(repositoryClass="GDS\Entity\Repository\AccountRepository")
 */
class Account
{
    public function setAccountvalidated($accountvalidated)
    {
        $this->accountvalidated = $accountvalidated;
    }

    public function getAccountvalidated()
    {
        return $this->accountvalidated;
    }

    public function setEmailaddress($emailaddress)
    {
        $this->emailaddress = $emailaddress;
    }

    public function getEmailaddress()
    {
        return $this->emailaddress;
    }

    public function setPassword($password)
    {
        $this->password = $password;
    }

    public function getPassword()
    {
        return $this->password;
    }

    public function setUsername($username)
    {
        $this->username = $username;
    }

    public function getUsername()
    {
        return $this->username;
    }

    public function setProfileId($profile_id)
    {
        $this->profile_id = $profile_id;
    }

    public function getProfileId()
    {
        return $this->profile_id;
    }

    public function setValidationstring($validationstring)
    {
        $this->validationstring = $validationstring;
    }

    public function getValidationstring()
    {
        return $this->validationstring;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @var integer $id
     * @Column(name="id", type="integer",nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @OneToOne(targetEntity="Profile", mappedBy="account", cascade={"persist"})
     */

    private $profile_id;

    /**
     * @Column(type="string", unique=true, length="25", nullable=false)
     */
    private $username;

    /**
     * @Column(type="string", length="25", nullable=true)
     */
    private $password;

    /**
     * @Column(type="string", unique=true, length="75", nullable=false)
     */
    private $emailaddress;

    /**
     * @Column(type="boolean", nullable=false)
     */
    private $accountvalidated;

    /**
    * @Column(type="string", length="125", nullable=true)
    */
    private $validationstring;
}

Profile entity

namespace GDS\Entity;
/**
 * @Entity(repositoryClass="GDS\Entity\Repository\ProfileRepository")
 */
class Profile
{
    public function setAboutme($aboutme)
    {
        $this->aboutme = $aboutme;
    }

    public function getAboutme()
    {
        return $this->aboutme;
    }

    public function setAccountId($account_id)
    {
        $this->account_id = $account_id;
    }

    public function getAccountId()
    {
        return $this->account_id;
    }

    public function setContactnameBattlelog($contactname_battlelog)
    {
        $this->contactname_battlelog = $contactname_battlelog;
    }

    public function getContactnameBattlelog()
    {
        return $this->contactname_battlelog;
    }

    public function setContactnameGw2($contactname_gw2)
    {
        $this->contactname_gw2 = $contactname_gw2;
    }

    public function getContactnameGw2()
    {
        return $this->contactname_gw2;
    }

    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;
    }

    public function getFirstname()
    {
        return $this->firstname;
    }

    /**
     * @var integer $id
     * @Column(name="id", type="integer",nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    public function setImageprofile($imageprofile)
    {
        $this->imageprofile = $imageprofile;
    }

    public function getImageprofile()
    {
        return $this->imageprofile;
    }

    public function setLastname($lastname)
    {
        $this->lastname = $lastname;
    }

    public function getLastname()
    {
        return $this->lastname;
    }

    public function setTeamspeakname($teamspeakname)
    {
        $this->teamspeakname = $teamspeakname;
    }

    public function getTeamspeakname()
    {
        return $this->teamspeakname;
    }

    public function setWebsite($website)
    {
        $this->website = $website;
    }

    public function getWebsite()
    {
        return $this->website;
    }

    /**
     * @OneToOne(targetEntity="Account", inversedBy="profile", cascade={"persist"})
     * @JoinColumn(name="account_id", referencedColumnName="id")
     */

    private $account_id;

    /**
     * @Column(type="string", length="25", nullable=true)
     */
    private $firstname;

    /**
     * @Column(type="string", length="25", nullable=true)
     */
    private $lastname;

    /**
     * @Column(type="string", length="25", nullable=true)
     */
    private $imageprofile;

    /**
     * @Column(type="string", length="50", nullable=true)
     */
    private $website;

    /**
     * @Column(type="string", length="50", nullable=true)
     */
    private $teamspeakname;

    /**
     * @Column(type="string", length="50", nullable=true)
     */
    private $contactname_gw2;

    /**
     * @Column(type="string", length="50", nullable=true)
     */
    private $contactname_battlelog;

    /**
     * @Column(type="text", length="500", nullable=true)
     */
    private $aboutme;
}
  • 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-13T12:05:22+00:00Added an answer on June 13, 2026 at 12:05 pm
    1. Your mapping is not correct.
    2. You do not need to call persist twice

    For example:

    class Account
    { 
        /**
        * @OneToOne(targetEntity="Profile", mappedBy="account", cascade={"persist"})
        */
        private $profile;
    
        public function setProfile(Profile $profile)
        {
            $this->profile = $profile;
            $profile->setAccount($this);
        }
    }
    
    class Profile
    {
        /**
        * @OneToOne(targetEntity="Account", inversedBy="profile", cascade={"persist"})
        */
        private $account;
    
        public function setAccount(Account $account)
        {
            $this->account = $account; 
        }
    }
    

    into your controller:

    $account = new GDS\Entity\Account;
    $profile = new GDS\Entity\Profile;
    
    $account->setProfile($profile);
    $em->persist($account);
    $em->flush();
    

    a profile entity persists automatically(cascade={“persist”})

    sorry for my english.

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

Sidebar

Related Questions

Not sure whats going on here, or what could be the integer in this
Not sure what's going on here... My controller methods looks like this: [HttpGet] public
Not too sure what's going on here as this doesn't seem like standard practise
I'm not too sure what's going on here but I'm trying to echo a
I've been at this bit of code for a while, but am not sure
I have a fairly simple script but something is going wrong and I can't
Not sure what's going on here, but my iPhone apps nav bar shows back
I'm not sure what's going on, but on my own laptop, everything works okay.
I'm not sure what's going on here but here's a section I'm having problems
CSS is not my strong suit, and I am not sure what's going on

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.