使用php Symfony2.8编辑YAML数组

使用php Symfony2.8编辑YAML数组,php,symfony,yaml,Php,Symfony,Yaml,我在Symfony有一个小项目,在那里我必须做一个认证系统。管理员可以更改一些参数,如密码的长度规则。 我用FosUserBundle 实际上,没有编辑,我有一个validation.yml,它工作得很好: UserBundle\Entity\User: properties: plainPassword: - NotBlank: message: "Il faut un mdp" - Length:

我在Symfony有一个小项目,在那里我必须做一个认证系统。管理员可以更改一些参数,如密码的长度规则。
我用FosUserBundle

实际上,没有编辑,我有一个validation.yml,它工作得很好:

UserBundle\Entity\User:
    properties:
        plainPassword:
          - NotBlank:
              message: "Il faut un mdp"
          - Length:
              min: 5
              max: 255
              minMessage: "Trop court (5 minimum)"
              maxMessage: "Trop Long (2555 maximum)"
              groups: [Registration,Profile]
          - Regex:
              pattern: /[0-9]+/
              message: "Doit inclure un chiffre "
              groups: [Registration,Profile]
          - Regex:
              pattern: /[!@#$%^*_-]+/
              message: "Doit inclure un caractère : '!,@,#,$,%,^,*'  "
              groups: [Registration,Profile]
          - Regex:
              pattern: /[A-Z]+/
              message: "Doit inclure une majuscule  "
              groups: [Registration,Profile]
我在同一个文件夹中创建了class parameter.php:

<?php
    namespace UserBundle\Ressources\config;
    class Parameter 
    {   
        public function  __construct()
        {   
            $container->setParameter('UserBundle\Entity\User.properties.plainPassword', '-     Length:\nmin:5\nminMessage:"test"\ngroups: [Registration,Profile]');     
        }
    }
所以我必须解决这个问题,首先我不知道如何编辑数组YAML(明文密码) 这是用PHP编辑YAML文件的好方法吗?(在我想使用条令并在数据库中输入我必须在validation.yml上输入的内容之后)

   imports:
         - { resource: parameter.php }