我需要一点帮助。
实体:
<?php
namespace UserBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\ORM\Mapping\Index;
/**
* User
*
* @ORM\Table(name="system_user")
* @ORM\Entity(repositoryClass="UserBundle\Entity\Repository\UserRepository")
*/
class User extends BaseUser
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
...
}
该学说看到了该注释的问题。我查看了所有可以找到的问题,但没有一个解决方案无法解决我的问题。
错误:
[Semantical Error] The annotation "@Doctrine\ORM\Mapping\Table" in class UserBundle\Entity\User does not exist, or could not be auto-loaded.
autoload.php:
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/** @var ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
作曲:
{
"name": "...",
"license": "Commercial",
"type": "project",
"description": "...",
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
"symfony/monolog-bundle": "^3.0.2",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~2.0@dev",
"friendsofsymfony/jsrouting-bundle": "^1.5",
"ocramius/proxy-manager": "2.0.*",
"doctrine/doctrine-migrations-bundle": "^1.1",
"nelmio/security-bundle": "^1.8",
"willdurand/faker-bundle": "^1.3",
"nelmio/api-doc-bundle": "^2.13",
"sonata-project/admin-bundle": "3.3",
"sonata-project/doctrine-orm-admin-bundle": "3.0",
"acseo/change-password-bundle": "dev-master#9c42fab1aa67e0b2211e37832bf3a2a398cb9b42",
"snc/redis-bundle": "^1.1",
"knplabs/knp-paginator-bundle": "^2.5",
"liip/imagine-bundle": "^1.5",
"egeloen/ckeditor-bundle": "^4.0",
"jms/serializer-bundle": "^1.1",
"phpoffice/phpexcel": "^1.8",
"ftrrtf/rollbar-bundle": "^0.15.1",
"knplabs/knp-snappy-bundle": "^1.4",
"iio/libmergepdf": "~3.0",
"php-amqplib/rabbitmq-bundle": "^1.10",
"darsyn/ip": "3.3.*",
"thadafinser/user-agent-parser": "2.0.0",
"friendsofphp/php-cs-fixer": "^1.11",
"browscap/browscap-php": "^3.0",
"donatj/phpuseragentparser": "^0.5.0",
"endorphin-studio/browser-detector": "^3.0",
"handsetdetection/php-apikit": "^4.1.10",
"jenssegers/agent": "^2.3",
"mobiledetect/mobiledetectlib": "^2.7.5",
"piwik/device-detector": "^3.6",
"sinergi/browser-detector": "^6.0",
"ua-parser/uap-php": "^3.4.3",
"whichbrowser/parser": "^2.0.10",
"woothee/woothee": "^1.2",
"mimmi20/wurfl": "^1.7.1.1",
"zsxsoft/php-useragent": ">=1.2,<1.4"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7",
"phing/phing": "^2.14",
"phpunit/phpunit": "5.3.*",
"squizlabs/php_codesniffer": "^2.6",
"phploc/phploc": "^3.0",
"phpmd/phpmd": "^2.4",
"sebastian/phpcpd": "^2.0"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.8-dev"
}
}
}
如果有人能解决这个问题我会很高兴的。我不能。
答案 0 :(得分:0)
我看不出有人能解决这个问题,所以我从config.yml粘贴我的contenf:
framework:
#esi: ~
translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: session.handler.native_file
save_path: '%kernel.root_dir%/../var/sessions'
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
types:
ip: Darsyn\IP\Doctrine\IpType
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
default_repository_class: Doctrine\ORM\EntityRepository
auto_mapping: true
resolve_target_entities:
FOS\UserBundle\Model\User: UserBundle\Entity\User
答案 1 :(得分:0)
您是否尝试清除并加热正在运行此环境的缓存?
php app/consle cache:clear -e test
php app/consle cache:warmup -e test