validator icon indicating copy to clipboard operation
validator copied to clipboard

Can't dump rules under Nested rule

Open BoShurik opened this issue 2 years ago • 0 comments

class Profile
{
    #[Nested]
    public ?Requisites $requisites = null;
}

class Requisites
{
    #[Required]
    public string $bik;

    #[Required]
    public string $rs;
}

RulesDumper::asArray((new ObjectDataSet(new Profile()))->getRules());

Result will be:

'requisites' => [
    0 => [
        0 => 'nested'
        'noRulesWithNoObjectMessage' => [
'template' => 'Nested rule without rules can be used for objects only.'
            'parameters' => []
        ]
        'incorrectDataSetTypeMessage' => [
'template' => 'An object data set data can only have an array type.'
            'parameters' => []
        ]
        'incorrectInputMessage' => [
'template' => 'The value must be an array or an object.'
            'parameters' => []
        ]
        'noPropertyPathMessage' => [
'template' => 'Property "{path}" is not found.'
            'parameters' => []
        ]
        'requirePropertyPath' => false
        'skipOnEmpty' => false
        'skipOnError' => false
        'rules' => null
    ]
]

BoShurik avatar Mar 03 '23 13:03 BoShurik