Symfony PropertyInfo组件不检索属性类型

时间:2017-06-12 12:52:50

标签: php symfony symfony-3.3

我有一个小班:

<?php

namespace AuthenticationBundle\Entity;

/**
 * Class UserAuthentication
 *
 * @package AuthenticationBundle
 */
class UserAuthentication
{

    /**
     * @var string
     */
    private $username;

    /**
     * @var string
     */
    private $password;

    /**
     * Set username
     *
     * @param string $username
     */
    public function setUsername($username)
    {
        $this->username = $username;
    }

    /**
     * Get username
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set password
     *
     * @param string $password
     */
    public function setPassword($password)
    {
        $this->password = $password;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }
}

然后我尝试检索它的属性类型:

$this->get('property_info')->getTypes(UserAuthentication::class, 'username')

返回null。知道为什么proprty信息组件无法读取我的@var注释吗?

0 个答案:

没有答案