SYMBOK @DATA注释已导入,但字段似乎不使用它



我已经创建了Entity class lighte.php,并希望字段在其中使用@Data注释。

实际上,我实际上尝试了https://github.com/mtarld/symbok-bundle中的按照说明,其中包括带有默认配置的编辑symbok.yaml(没有文件,所以我必须在config/packages/packages/(下创建它。。此外,我已经检查了作曲家是否正确添加了捆绑包,而且一切似乎都可以。

员工.php:

namespace AppEntity;
use DoctrineORMMapping as ORM;
use MtarldSymbokBundleAnnotationData;
use MtarldSymbokBundleAnnotationToString;
/**
 * @Data
 * @ToString
 * @ORMEntity(repositoryClass="AppRepositoryEmployeeRepository")
 */
class Employee
{
    /**
     * @ORMId
     * @ORMGeneratedValue
     * @ORMColumn(type="integer")
     * @var int
     */
   private $id;
    /**
     * @ORMColumn(type="string", length=255)
     * @var string
     */
   private $firstName;
    /**
     * @ORMColumn(type="string", length=255)
     * @var string
     */
    private $lastName;
}

symbok.yaml:

symbok:
    # Namespaces that you wanna be processed
    namespaces:
        - 'AppEntity'
        - 'AppModel'
    # Cache activation (useful to disable it when developing)
    cache: ~
    defaults:
        # If setters are fluent by default (default false)
        fluent_setters: ~
        nullable:
            # If getters and setters use/return nullable parametes/values (default false)
            getter_setter: ~
            # If constructor uses nullable parameters (default true)
            constructor: ~

bundles.php:

<?php
return [
    SymfonyBundleFrameworkBundleFrameworkBundle::class => ['all' => true],
    DoctrineBundleDoctrineCacheBundleDoctrineCacheBundle::class => ['all' => true],
    SensioBundleFrameworkExtraBundleSensioFrameworkExtraBundle::class => ['all' => true],
    DoctrineBundleDoctrineBundleDoctrineBundle::class => ['all' => true],
    DoctrineBundleMigrationsBundleDoctrineMigrationsBundle::class => ['all' => true],
    SymfonyBundleSecurityBundleSecurityBundle::class => ['all' => true],
    SymfonyBundleSwiftmailerBundleSwiftmailerBundle::class => ['all' => true],
    SymfonyBundleTwigBundleTwigBundle::class => ['all' => true],
    SymfonyBundleWebProfilerBundleWebProfilerBundle::class => ['dev' => true, 'test' => true],
    SymfonyBundleMonologBundleMonologBundle::class => ['all' => true],
    SymfonyBundleDebugBundleDebugBundle::class => ['dev' => true, 'test' => true],
    SymfonyBundleMakerBundleMakerBundle::class => ['dev' => true],
    SymfonyBundleWebServerBundleWebServerBundle::class => ['dev' => true],
    MtarldSymbokBundleSymbokBundle::class => ['all' => true],
];

我所拥有的只是"未使用的私人领域。而且,当我跑步时: PHP垃圾箱/控制台学说:架构:更新

我有:

在AnnotationException.php行54中:

[语义错误] class App Entity employe中的注释" @data"从未导入。您是否忘记了为此注释添加"使用"语句?

我假设未使用的私有字段是phpmd通知。如果是这种情况,只需在类上添加@SuppressWarnings(PHPMD.UnusedPrivateField)注释。

对于@Data注释错误,请尝试2.0版本。

最新更新