파일 시스템에서 클래스를 이동 한 후 "XXX 클래스는 유효한 엔티티 또는 매핑 된 수퍼 클래스가 아닙니다."
Aib \ PlatformBundle \ Entity \ User.php에 엔티티 클래스가 있습니다.
폼 클래스를 만드는 데 아무런 문제가 없었습니다.
php app / console doctrine : generate : form AibPlatformBundle : User
이제 네임 스페이스를 Aib \ PlatformBundle \ Entity \ Identity \ User로 변경했지만 작업으로 양식을 생성하려고 할 때 이전에 다음과 같이 말했습니다.
"Class Aib \ PlatformBundle \ Entity \ User는 유효한 엔티티 또는 매핑 된 수퍼 클래스가 아닙니다."
다음은 파일 내용입니다.
<?php
namespace Aib\PlatformBundle\Entity\Identity;
use Doctrine\ORM\Mapping as ORM;
/**
* Aib\PlatformBundle\Entity\Identity\User
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Aib\PlatformBundle\Entity\Identity
\UserRepository")
*/
class User
{
...
어떤 생각?
심포니 2.0.4
이 문제가있었습니다- * @ORM\Entity
아래와 같은 주석을 잊지 마십시오 .
/**
* Powma\ServiceBundle\Entity\User
*
* @ORM\Entity
* @ORM\Table(name="users")
*/
어제이 문제가 있었고이 스레드를 찾았습니다. 새 번들 (예 : MyFooBundle / Entity / User.php)에서 매핑으로 엔터티를 생성하고 문서에 따라 모든 구성을 수행했지만 앱을로드하려고 할 때 위에서 동일한 오류가 발생했습니다.
결국 나는 AppKernel에서 MyFooBundle을로드하지 않는다는 것을 깨달았습니다.
new My\FooBundle\MyFooBundle()
이를 디버깅하는 가장 좋은 방법은 다음 명령을 실행하는 것입니다.
app/console doctrine:mapping:info
config.yml 파일을 확인하십시오. 다음과 같은 내용이 포함되어 있어야합니다.
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
types:
json: Sonata\Doctrine\Types\JsonType
orm:
auto_generate_proxy_classes: %kernel.debug%
# auto_mapping: true
entity_managers:
default:
mappings:
FOSUserBundle: ~
# ApplicationSonataUserBundle: ~
YourUserBundle: ~
SonataUserBundle: ~
매핑 목록에 고유 한 번들을 추가합니다.
제 경우에는 서버 캐시를 eAccelerator 에서 APC 로 변경하여 문제가 해결되었습니다 . 분명히 eAccelerator는 주석을 깨는 파일에서 모든 주석을 제거합니다.
false
두 번째 매개 변수로 전달하여이 문제를 해결 했습니다 Doctrine\ORM\Configuration::newDefaultAnnotationDriver
.
It took me a while of digging through Google and source code.
My case was sort of special since I was using a mapping pointing to another directory unrelated to the Symfony installation as I also had to use legacy code.
I had refactored legacy entities and they stopped working. They used to use @Annotation
instead of @ORM\Annotation
, so after refactoring it simply failed to read the metadata. By not using a simple annotation reader, everything seems to be okayish.
I resolved this issue by setting $useSimpleAnnotationReader=false
when creating the MetaDataConfiguration
.
big thx to Mark Fu and mogoman
I knew it had to be somewhere in the config.yml... and being able to test it against the
app/console doctrine:mapping:info
really helped!
In fact, this command just simply stops at an error... no feedback, but when everything is fine you should be able to see all your entities listed.
I resolved the same exception by deleting a conflicting autogenerated orm.php file in the bundle's Resources/config/doctrine folder; according to the documentation: "A bundle can accept only one metadata definition format. For example, it's not possible to mix YAML metadata definitions with annotated PHP entity class definitions."
Very high possibility that you have PHP 5.3.16 (Symfony 2.x will not work with it). Anyway you should load check page on http://you.site.name/config.php If you had project not worked on hosting server, next lines must be removed in "config.php":
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
Goodluck!
In my case, I was too zealous during a refactor and had deleted a doctrine yml file!
I got rid of the same error message as in your case by using app/console_dev instead of just app/console
'developer tip' 카테고리의 다른 글
확장 방법의 장점은 무엇입니까? (0) | 2020.09.20 |
---|---|
<0xEF, 0xBB, 0xBF> 문자가 파일에 표시됩니다. (0) | 2020.09.20 |
내부 서버 오류-htaccess (0) | 2020.09.20 |
webpack --watch가 변경된 파일을 컴파일하지 않습니다. (0) | 2020.09.20 |
VS2012가 일반 TFS 체크인 창으로 돌아 갑니까? (0) | 2020.09.19 |