创建服务时命名空间错误


namespace error when creating a service

Symfony2新手在这里

我尝试在我的应用程序中创建一个服务。我遵循symfony文档 下面是我的代码:

文件BC/MBundle/资源/config/services.yml:

---
services:
    metas:
        class: BC'MBundle'Metas'Metas

文件BC/MBundle/搜索

<?php
namespace BC'MBundle'Metas;    
class Metas {
    public function queryAllCategories() {
        return array();
    }
}

文件BC/MBundle/控制器/AController.php

<?php
namespace BC'MBundle'Controller;
// ...
use BC'MBundle'Metas'MetasController;
class AController extends Controller {
    public function homeAction() {
        return $this->render(
            'tpl.html.twig',
            array(
                'categories' => $this->get('metas')->queryAllCategories(),
             )
        );
    }
}

错误是:

Attempted to load class "Metas" from namespace "BC'MBundle'Metas".
Did you forget a "use" statement for another namespace?
  1. 移动

    文件BC/MBundle/搜索

    BC/MBundle/搜索/Metas.php

  2. 尝试使用

    清除缓存
    php app/console cache:clear
    

    php app/console cache:clear --env=prod