2015-03-13 111 views
0

今天,我把我的symfony 2.6項目從我的本地Windows機器我的Linux Web服務器的Symfony2:學說:基表或視圖未找到:1146 tablename是相同

當我在我的網站去它會提示登錄頁面預期。 Im使用相同的用戶憑證登錄如何在本地登錄。我有一個用戶和一個角色表。我正在登錄成功後出現以下錯誤提示:發生

例外在執行 'SELECT t0.id AS ID1,t0.name AS NAME2,t0.color AS COLOR3 FROM員工T0': SQLSTATE [42S02 ]:未找到基本表或視圖:1146'dzqoqnoa_cms.employee'不存在

我已經檢查過谷歌,但是我發現只有小寫的問題。

我的實體:

namespace WO\OrganizerBundle\Entity; 

use Doctrine\Common\Collections\ArrayCollection; 
use Doctrine\ORM\Mapping as ORM; 

/** 
* Employee 
* 
* @ORM\Table(name="employee") 
* @ORM\Entity(repositoryClass="WO\OrganizerBundle\Entity\EmployeeRepository") 
*/ 
class Employee 
{ 
    /** 
    * @var integer 
    * 
    * @ORM\Column(name="id", type="integer") 
    * @ORM\Id 
    * @ORM\GeneratedValue(strategy="AUTO") 
    */ 
    private $id; 

    /** 
    * @var string 
    * 
    * @ORM\Column(name="name", type="string", length=255) 
    */............. 

我的控制器:

$em = $this->getDoctrine()->getManager(); 
$employees = $em->getRepository('WOOrganizerBundle:Employee')->findAll(); 

我的數據庫:

Database structure on server

我已經用下面的命令清除所有緩存:

php app/console doctrine:cache:clear-metadata 
php app/console doctrine:cache:clear-query 
php app/console doctrine:cache:clear-result 
rm -rf app/cache/ 

哪裏出問題?

編輯

這裏是我的配置文件:

config.yml

imports: 
    - { resource: parameters.yml } 
    - { resource: security.yml } 
    - { resource: services.yml } 

framework: 
    #esi:    ~ 
    #translator:  { fallbacks: ["%locale%"] } 
    secret:   "%secret%" 
    router: 
     resource: "%kernel.root_dir%/config/routing.yml" 
     strict_requirements: ~ 
    form:   ~ 
    csrf_protection: ~ 
    validation:  { enable_annotations: true } 
    templating: 
     engines: ['twig'] 
     #assets_version: SomeVersionScheme 
    default_locale: "%locale%" 
    trusted_hosts: ~ 
    trusted_proxies: ~ 
    session: 
     # handler_id set to null will use default session handler from php.ini 
     handler_id: ~ 
    fragments:  ~ 
    http_method_override: true 

# Twig Configuration 
twig: 
    debug:   "%kernel.debug%" 
    strict_variables: "%kernel.debug%" 

# Assetic Configuration 
assetic: 
    debug:   "%kernel.debug%" 
    use_controller: false 
    bundles:  [ ] 
    #java: /usr/bin/java 
    filters: 
     cssrewrite: ~ 
     #closure: 
     # jar: "%kernel.root_dir%/Resources/java/compiler.jar" 
     #yui_css: 
     # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar" 

# Doctrine Configuration 
doctrine: 
    dbal: 
     driver: "%database_driver%" 
     host:  "%database_host%" 
     port:  "%database_port%" 
     dbname: "%database_name%" 
     user:  "%database_user%" 
     password: "%database_password%" 
     charset: UTF8 
     # if using pdo_sqlite as your database driver: 
     # 1. add the path in parameters.yml 
     #  e.g. database_path: "%kernel.root_dir%/data/data.db3" 
     # 2. Uncomment database_path in parameters.yml.dist 
     # 3. Uncomment next line: 
     #  path:  "%database_path%" 

    orm: 
     auto_generate_proxy_classes: "%kernel.debug%" 
     auto_mapping: true 

# Swiftmailer Configuration 
swiftmailer: 
    transport: "%mailer_transport%" 
    host:  "%mailer_host%" 
    username: "%mailer_user%" 
    password: "%mailer_password%" 
    spool:  { type: memory } 

config_prod.yml

imports: 
    - { resource: config.yml } 

monolog: 
    handlers: 
     main: 
      type:   fingers_crossed 
      action_level: error 
      handler:  nested 
     nested: 
      type: stream 
      path: "%kernel.logs_dir%/%kernel.environment%.log" 
      level: debug 
     console: 
      type: console 

現在我重新命名都來自小寫(員工)大寫(員工),但沒有任何改變!

+0

您的存儲庫類存在於'WO \ OrganizerBundle \ Entity'命名空間嗎? – xurshid29 2015-03-13 11:14:59

+0

@ xurshid29:是的 – Tanktiger 2015-03-13 11:52:06

回答

0

你的Linux服務器是區分大小寫,因此解決方案只是與

RENAME TABLE tbl_name TO new_tbl_name改變你的表名;

從員工到員工 例如 RENAME TABLE employee to Employee。如果還有其他申請。

+0

但是爲什麼我在登錄時不需要這個?表角色和用戶和users_role是小寫 – Tanktiger 2015-03-13 15:40:32

+0

我做到了,但沒有任何改變 – Tanktiger 2015-03-13 15:43:37

0

我的服務器提供商更改我的項目目錄到另一臺服務器,所以我可以使用PHP 5.5.2,但我沒有得到有關它的通知。所以我的ssh地址改變了,並且dns沒有在新的ftp地址中檢查。

現在一切正常工作。

相關問題