2013-07-03 85 views
2

我用這個之前Symfony2 and Google API integration的Symfony 2.3添加谷歌API

我有一個關於這個問題,當我使用類映射在compser.json我能夠得到的Google_Client類,但我無法使用任何其他類。例如,我想使用Goole_YoutubeService。我有...

$client = new \Google_Client(); 
$youtube = new \Google_YoutubeService($client); 

當我做我的代碼識別Google_Client(),但找不到Google_YoutubeService()

我是否錯過了某些東西才能使之起作用?

這是我composer.json

{ 
    "name": "symfony/framework-standard-edition", 
    "description": "The \"Symfony Standard Edition\" distribution", 
    "autoload": { 
     "psr-0": { "": "src/" }, 
     "classmap": ["vendor/google/google-api-php-client/src","vendor/google/google-api-php-clien‌​t/src/contrib"] 

}, 
"require": { 
    "php": ">=5.3.3", 
    "symfony/symfony": "2.3.*", 
    "doctrine/orm": "~2.2,>=2.2.3", 
    "doctrine/doctrine-bundle": "1.2.*", 
    "twig/extensions": "1.0.*", 
    "symfony/assetic-bundle": "2.3.*", 
    "symfony/swiftmailer-bundle": "2.3.*", 
    "symfony/monolog-bundle": "2.3.*", 
    "sensio/distribution-bundle": "2.3.*", 
    "sensio/framework-extra-bundle": "2.3.*", 
    "sensio/generator-bundle": "2.3.*", 
    "google/google-api-php-client": "1.0.0" 

}, 
"require-dev": { 
    "phpunit/phpunit": "3.7.*", 
    "phake/phake": "1.*" 
}, 
"scripts": { 
    "post-install-cmd": [ 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" 
    ], 
    "post-update-cmd": [ 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
     "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" 
    ] 
}, 
"config": { 
    "bin-dir": "bin" 
}, 
"minimum-stability": "alpha", 
"extra": { 
    "symfony-app-dir": "app", 
    "symfony-web-dir": "web", 
    "branch-alias": { 
     "dev-master": "2.2-dev" 
    } 
}, 
"repositories": [ 
{ 
    "type": "package", 
    "package": { 
     "name": "google/google-api-php-client", 
     "version": "1.0.0", 
     "source": { 
      "type": "svn", 
      "url": "http://google-api-php-client.googlecode.com/svn", 
      "reference": "trunk" 
     } 
    } 
} 
] 
} 
+0

是否'\的contrib \ Google_YoutubeService($客戶端);'工作? – Paulpro

+0

調用未定義的函數contrib \\ Google_YoutubeService()不會我得到這個錯誤 – gsitu322

+0

請參閱您在鏈接到自動加載部分的答案?嘗試添加到類圖:'「classmap」:[「vendor/project/google-api-php-client/src」,「vendor/project/google-api-php-client/src/contrib」] – Paulpro

回答

3

嘗試Google_YouTubeService - 大寫YouTube的 - 它會工作

+0

謝謝!我意識到,當我看着班級映射。 – gsitu322