FOSUserBundle MappingException

0

Я развертывал систему с Symfony2, FOSUserBundle & Fr3dLdapBundle, но у меня возникла следующая проблема:

MappingException: Class "XXX\Shared\XXXUserBundle\Entity\User" sub class of "FOS\UserBundle\Model\User" is not a valid entity or mapped super class.

Здесь объясняется, что eAccelerator несовместим, но у меня его нет:

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

Также попытался в очень недавней версии PHP, но проблема сохраняется:

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

На моей локальной системе Windows с Xammp 1.7.7 (PHP 5.3.8) все работает отлично !.

PHP 5.3.8 (cli) (built: Aug 23 2011 11:50:20)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.1, Copyright (c) 2002-2011, by Derick Rethans

Файл User.php

C:\XAMPP\HTDOCS\Symfony2\SRC\Xyz\Shared\XYUserBundle\Entity\User.php

Примечание. Xyz и XYUserBundle представляют собой фактическую капитализацию текста.

User.php выглядит следующим образом:

<?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);
    }

}

Файл 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

В чем может быть проблема?

Теги:
fosuserbundle
fr3dldapbundle

2 ответа

0
Лучший ответ

Проблема заключалась в имени директории config/D octrine

Решено sstok в GitHub:

1

Я думаю, ваша проблема в том, что вы не использовали

/** * @ORM\Entity() **/

в начале вашего пользовательского объекта

  • 0
    Спасибо, я обновил вопрос с ответом, была проблема с буквой.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню