Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MappingException #1665

Closed
vlad88sv opened this issue Oct 29, 2014 · 10 comments
Closed

MappingException #1665

vlad88sv opened this issue Oct 29, 2014 · 10 comments

Comments

@vlad88sv
Copy link

Hi,

I was deploying a system but I got the same problem as issue #1215, the problem in question is:

MappingException: Class "XXX\Shared\XXXUserBundle\Entity\User" sub class of "FOS\UserBundle\Model\User" is not a valid entity or mapped super class.
  • I don't have eAccelerator
$ php -v
PHP 5.3.3 (cli) (built: Feb 22 2013 02:51:11) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
  • Works fine in localhost

I tried:

  • Updating vendors with composer
  • Clearing caches

I don't know what else I may try?

@vlad88sv
Copy link
Author

Any thoughts on this?

@vlad88sv
Copy link
Author

Please?

@sstok
Copy link

sstok commented Nov 11, 2014

Is your localhost system Windows? Windows is case insensitive for filenames.
If you have a class User in user.php, this will work on Windows as Doctrine is looking a file named User.php and on Windows user.php will also match.

@vlad88sv
Copy link
Author

Thank you,

yes, my localhost system is Windows, but file path is:
C:\xampp\htdocs\Symfony2\src\Xyz\Shared\XYUserBundle\Entity\User.php

Note: Xyz and XYUserBundle represent actual text capitalization.

User.php is as following:

<?php
namespace Xyz\Shared\XYUserBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use FR3D\LdapBundle\Model\LdapUserInterface;

/**
 * User
 */
class User extends BaseUser implements LdapUserInterface
{

    // Esta variable sirve para almacenar (cache) la ruta del usuario en el LDAP
    protected $dn;

    protected $employeeid;

    /**
     * Set Ldap Distinguished Name
     *
     * @param string $dn Distinguished Name
     */
    public function setDn($dn){
        $this->dn = $dn;

        return $this;
    }

    /**
     * Get Ldap Distinguished Name
     *
     * @return string Distinguished Name
     */
    public function getDn(){
         return $this->dn;
    }


    public function setEmployeeid($employeeid)
    {
        $this->employeeid = $employeeid;

        return $this;        
    }

    public function getEmployeeid(){
        return $this->employeeid;
    }

    public function serialize()
    {
        return serialize(array(
            $this->password,
            $this->salt,
            $this->usernameCanonical,
            $this->username,
            $this->emailCanonical,
            $this->email,
            $this->expired,
            $this->locked,
            $this->credentialsExpired,
            $this->enabled,
            $this->id,
            $this->roles,
            $this->dn,
        ));
    }

    public function unserialize($serialized)
    {
        list(
            $this->password,
            $this->salt,
            $this->usernameCanonical,
            $this->username,
            $this->emailCanonical,
            $this->email,
            $this->expired,
            $this->locked,
            $this->credentialsExpired,
            $this->enabled,
            $this->id,
            $this->roles,
            $this->dn,
        ) = unserialize($serialized);
    }

}

@vlad88sv
Copy link
Author

Also, this is the User.orm.yml:
C:\xampp\htdocs\Symfony2\src\Xyz\Shared\XYUserBundle\Resources\config\Doctrine\User.orm.yml

Xyz\Shared\XYUserBundle\Entity\User:
    type:  entity
    table: fos_user
    id:
        id:
            type: integer
            generator:
                strategy: AUTO
    fields:
        dn:
            type: string
            nullable: false
            length: 255
            fixed: false
            comment: ''
            column: dn
        employeeid:
            type: string
            nullable: false
            length: 15
            fixed: false
            comment: ''
            column: employeeid

@vlad88sv
Copy link
Author

In case is useful:
image

@vlad88sv
Copy link
Author

To discard PHP version incompatibilities I've tried with another (more up to date) server, but issue persists.

PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

@sstok
Copy link

sstok commented Nov 12, 2014

Try changing the config/Doctrine directory name to lowercase config/doctrine.

@vlad88sv
Copy link
Author

Thank you so much!. That was the problem!

@sstok
Copy link

sstok commented Nov 12, 2014

No problem, can you close this issue? ;)

@stof stof closed this as completed Nov 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants