跳至主要内容

Unrecognized field: usernameCanonical for symfony2 FosUserbundle

I got this error when try to login to my system. I searched in internet and find this could be caused by several problems, of cause if your configuration is the following:
  orm:
    auto_generate_proxy_classes: %kernel.debug%
    default_entity_manager: italy
    entity_managers:
      italy:
        connection: italy
        mappings:
          MobMindsCoreBundle: ~
          FOSUserBundle: ~
        metadata_cache_driver: apc
        query_cache_driver: apc
        result_cache_driver:
          type:           memcache
          host:           %memcache_host%
          port:           %memcache_port%
          instance_class: Memcache
          class:          Doctrine\Common\Cache\MemcacheCache
      world:
        connection: world
        mappings:
          MobMindsCoreBundle: ~
          FOSUserBundle: ~
        metadata_cache_driver: apc
        query_cache_driver: apc
        result_cache_driver:
          type:           memcache
          host:           %memcache_host%
          port:           %memcache_port%
          instance_class: Memcache
          class:          Doctrine\Common\Cache\MemcacheCache



1. you need to clear apc cache of doctrine. There are 3 ways to do so:
  a. php app/console doctrine:cache:clear-metadata
      if it says :  Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI.  
so you need this :
  b. clear by this script:
 
require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
$cacheDriver = new \Doctrine\Common\Cache\ApcCache();
$cacheDriver->deleteAll();


in your /web directory.
  c. by a script given by apache cli apc. which can found in their site.

2. other wise it is because you use auto-mapping: enable and then you pass to multi-entities managers, you need to specify the bundles who will use which entity, and this is my problem, i have forgotten to mapping the fosUserBundle with default entity manager, and after i add it , all works well.

        entity_managers:
            default:
                connection:       default
                metadata_cache_driver: apc
                query_cache_driver: apc
                result_cache_driver: apc
                mappings:
                    AcmeUserBundle: ~
                    AcmeBannieresBundle: ~
                    FOSUserBundle: ~

评论

此博客中的热门博文

jquery on 的问题

return false  from  within a jQuery event handler  is effectively the same as calling both  e.preventDefault and  e.stopPropagation  on the passed  jQuery.Event object. e.preventDefault()  will prevent the default event from occuring,  e.stopPropagation()  will prevent the evet from bubbling up and  return false  will do both. Note that this behaviour differs from  normal  (non-jQuery) event handlers, in which, notably,  return false   does  not  stop the event from bubbling up . 所以on前半部分的selector必须是静态的。

chrome extension Error: attempting to use a disconnected prot object

if you get this error: Port error: Could not establish connection. Receiving end does not exist. miscellaneous_bindings:236 chromeHidden.Port.dispatchOnDisconnect miscellaneous_bindings:236 Uncaught Error: Attempting to use a disconnected port object miscellaneous_bindings:58 PortImpl.postMessage miscellaneous_bindings:58 responseCallback miscellaneous_bindings:143 xhr.onreadystatechange That means you have make some mistake as this discussed: This is caused when a connection get closed. For example if you open a tab that has the content_script injected, it opens a connection, the tab is closed, and then the background_page tries to pass a message. It will fail because the tab is no longer active to receive the message. In your case I would guess that as tabs close and new tabs open you are attempting to post messages with the old tabId instead of creating a new connection to the new tab. I would recommend reading through the  long-lived connections s

工作合同 , 离职,工会 相关

转自战法: 平常受主管和同事歧视和欺负,准备把他们告到 Prud'hommes, 所以最近和工会的人走的比较近,学会如何 monter un dossier, 和一些保护自己的方法,特别想跟大家分享。 1. Il faut acter 也就是说,如果同事对你有行为或言语上的 Harcèlement, 当下不要过激,但是一定要给主管发一封邮件。 邮件可以保存下来作为证据。 邮件是 Daté 的,可以记录时间日期。 只要邮件是你发的,对方回不回都无所谓,因为你已经公开表示了不满。 如果是言语骚扰,邮件里一定要引用同事骚扰你的原话。 邮件不要有攻击性,你的请求一定是合理的,但是让对方很难回复。比如我主管不批我的RTT,因为他说“RTT不能半天半天的批”,于是工会的哥们帮我起草了一封邮件,就说“我这个月想提交RTT申请的时候,惊讶地发现四月份的申请被拒了。我不明白,全公司的员工都可以请半天的RTT,为什么我不行?而且你已经批了我三月份两个半天RTT的申请。“ 2. Prise d'acte 如果公司没有很好的履行合同,没有支付工资,同事对你有骚扰,甚至是暴力,等等,你就可以立刻终止你的合同。 这个很厉害,不要轻易使用。因为如果法官判定你的请求不合理,就要赔偿公司 Préavis 的钱。 相关链接: http://vosdroits.service-public.fr/F24409.xhtml http://www.journaldunet.com/management/pratique/contrats/4643/la-prise-d-acte.html http://www.juritravail.com/Actualite/prise-acte-rupture-par-salarie/Id/2136  (prise d'acte 和 démission 的区别) 3. 保存邮件 最好是把你所有的邮件都保存在U盘上,备份在自己家的电脑,以免公司突然给你来个 mise à pied, 你就没办法带走任何证据了。但是千万不要大张旗鼓地做,要不然公司就会怀疑你要做什么对公司不好的事。 4. 最有,一些有用链接: http://vosdroits.service-public.fr/particuliers/N19806.xh