感谢您的推荐 关于我以前的操作系统从Windows 7更改为ubuntu 12.04的问题,我有一天感到震惊。 在我的Windows中,symfony应用程序运行在PHP 5.5.6上,在5.5.6版本中运行的ubuntu应用程序中运行相同。但现在我得到了实体关系中的错误。我试图解决它,但我没有成功。
相同的代码也在另一个Windows 7系统上运行,但我需要在linux中运行。
请为我提供解决方案。
以下链接是dropbox,您可以在其中找到所有实体。
访问https://www.dropbox.com/sh/rr7d31ah71sagwp/AACb7LW3r0R8ugvaDmkvERACa?dl=0
以下是错误:
检测到异常! 目标实体Collegelife \ CommonBundle \ Entity \ countrycity在' Collegelife \ CommonBundle \ Entity \ Country#countrycityassociation'中找不到。
堆栈跟踪
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php at line 740 -
*/
public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName)
{
return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'.");
}
/**
at MappingException ::invalidTargetEntityClass ('Collegelife\CommonBundle\Entity\countrycity', 'Collegelife\CommonBundle\Entity\Country', 'countrycityassociation')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php at line 953 -
{
foreach ($this->associationMappings as $mapping) {
if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
}
}
}
at ClassMetadataInfo ->validateAssociations ()
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php at line 199 -
}
$class->validateIdentifier();
$class->validateAssociations();
$class->validateLifecycleCallbacks($this->getReflectionService());
// verify inheritance
at ClassMetadataFactory ->validateRuntimeMetadata (object(ClassMetadata), null)
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php at line 178 -
$this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
}
$this->validateRuntimeMetadata($class, $parent);
}
/**
at ClassMetadataFactory ->doLoadMetadata (object(ClassMetadata), null, false, array())
in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php at line 318 -
$class = $this->newClassMetadataInstance($className);
$this->initializeReflection($class, $reflService);
$this->doLoadMetadata($class, $parent, $rootEntityFound, $visited);
$this->loadedMetadata[$className] = $class;
at AbstractClassMetadataFactory ->loadMetadata ('Collegelife\CommonBundle\Entity\Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php at line 211 -
$this->loadedMetadata[$realClassName] = $cached;
$this->wakeupReflection($cached, $this->getReflectionService());
} else {
foreach ($this->loadMetadata($realClassName) as $loadedClassName) {
$this->cacheDriver->save(
$loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null
);
at AbstractClassMetadataFactory ->getMetadataFor ('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 295 -
*/
public function getClassMetadata($className)
{
return $this->metadataFactory->getMetadataFor($className);
}
/**
at EntityManager ->getClassMetadata ('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php at line 67 -
*/
protected function createRepository(EntityManagerInterface $entityManager, $entityName)
{
$metadata = $entityManager->getClassMetadata($entityName);
$repositoryClassName = $metadata->customRepositoryClassName;
if ($repositoryClassName === null) {
at DefaultRepositoryFactory ->createRepository (object(EntityManager), 'CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php at line 50 -
return $this->repositoryList[$entityName];
}
$repository = $this->createRepository($entityManager, $entityName);
$this->repositoryList[$entityName] = $repository;
at DefaultRepositoryFactory ->getRepository (object(EntityManager), 'CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 759 -
*/
public function getRepository($entityName)
{
return $this->repositoryFactory->getRepository($this, $entityName);
}
/**
at EntityManager ->getRepository ('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php at line 239 -
*/
public function getRepository($persistentObjectName, $persistentManagerName = null)
{
return $this->getManager($persistentManagerName)->getRepository($persistentObjectName);
}
/**
at AbstractManagerRegistry ->getRepository ('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/src/Collegelife/AdminBundle/Controller/CountryController.php at line 123 -
if (false === $this->get("security.context")->isGranted("ROLE_ADMIN")) {
throw new AccessDeniedException("Unable access this page");
}
$entity = $this->getDoctrine()->getRepository("CollegelifeCommonBundle:Country")->findAll();
return $this->render("CollegelifeAdminBundle:Country:list.html.twig", array("entity" => $entity));
}
at CountryController ->listAction (object(Request))
at call_user_func_array (array(object(CountryController), 'listAction'), array(object(Request)))
in kernel.root_dir/bootstrap.php.cache at line 2889 -
$this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event);
$controller = $event->getController();
$arguments = $this->resolver->getArguments($request, $controller);
$response = call_user_func_array($controller, $arguments);
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
at HttpKernel ->handleRaw (object(Request), '1')
in kernel.root_dir/bootstrap.php.cache at line 2863 -
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if (false === $catch) {
throw $e;
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 2992 -
$this->container->enterScope('request');
$this->container->set('request', $request,'request');
try {
$response = parent::handle($request, $type, $catch);
} catch (\Exception $e) {
$this->container->set('request', null,'request');
$this->container->leaveScope('request');
at ContainerAwareHttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 2272 -
if (false === $this->booted) {
$this->boot();
}
return $this->getHttpKernel()->handle($request, $type, $catch);
}
protected function getHttpKernel()
{
at Kernel ->handle (object(Request))
in /opt/lampp/htdocs/collegelife/web/app_dev.php at line 28 -
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
日志
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
INFO - Matched route "_admin_country_list" (parameters: "_controller": "Collegelife\AdminBundle\Controller\CountryController::listAction", "_route": "_admin_country_list")
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest".
DEBUG - Read SecurityContext from the session
DEBUG - Reloading user from user provider.
DEBUG - SELECT t0.id AS id1, t0.firstname AS firstname2, t0.lastname AS lastname3, t0.email AS email4, t0.password AS password5, t0.created_at AS created_at6, t0.updated_at AS updated_at7 FROM admin t0 WHERE t0.email = ? LIMIT 1
DEBUG - Username "admin@collegelife.com" was reloaded from user provider.
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException".
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelException".
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ExceptionListener::onKernelException".
CRITICAL - Uncaught PHP Exception Doctrine\ORM\Mapping\MappingException: "The target-entity Collegelife\CommonBundle\Entity\countrycity cannot be found in 'Collegelife\CommonBundle\Entity\Country#countrycityassociation'." at /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php line 740
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
堆栈跟踪(纯文本)
[1] Doctrine \ ORM \ Mapping \ MappingException:目标实体Collegelife \ CommonBundle \ Entity \ countrycity在' Collegelife \ CommonBundle \ Entity \ Country#countrycityassociation'中找不到。 在n / a 在/opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php第740行
at Doctrine\ORM\Mapping\MappingException::invalidTargetEntityClass('Collegelife\CommonBundle\Entity\countrycity', 'Collegelife\CommonBundle\Entity\Country', 'countrycityassociation')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php line 953
at Doctrine\ORM\Mapping\ClassMetadataInfo->validateAssociations()
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php line 199
at Doctrine\ORM\Mapping\ClassMetadataFactory->validateRuntimeMetadata(object(ClassMetadata), null)
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php line 178
at Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(object(ClassMetadata), null, false, array())
in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php line 318
at Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('Collegelife\CommonBundle\Entity\Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php line 211
at Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 295
at Doctrine\ORM\EntityManager->getClassMetadata('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php line 67
at Doctrine\ORM\Repository\DefaultRepositoryFactory->createRepository(object(EntityManager), 'CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php line 50
at Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository(object(EntityManager), 'CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 759
at Doctrine\ORM\EntityManager->getRepository('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php line 239
at Doctrine\Common\Persistence\AbstractManagerRegistry->getRepository('CollegelifeCommonBundle:Country')
in /opt/lampp/htdocs/collegelife/src/Collegelife/AdminBundle/Controller/CountryController.php line 123
at Collegelife\AdminBundle\Controller\CountryController->listAction(object(Request))
in line
at call_user_func_array(array(object(CountryController), 'listAction'), array(object(Request)))
in /opt/lampp/htdocs/collegelife/app/bootstrap.php.cache line 2889
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /opt/lampp/htdocs/collegelife/app/bootstrap.php.cache line 2863
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /opt/lampp/htdocs/collegelife/app/bootstrap.php.cache line 2992
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in /opt/lampp/htdocs/collegelife/app/bootstrap.php.cache line 2272
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /opt/lampp/htdocs/collegelife/web/app_dev.php line 28