Definition Validation

By default, CRUDlex validates the yml file and throws an exception if anything is wrong.

Turning off Validation

This costs a bit of performance, so you might want to turn it off in your production environment as it should be sure at this point that the file is valid:

You can just leave out the last argument of the crudlex.service:

crudlex.service:
    public: true
    class: "CRUDlex\\Service"
    arguments:
      - "%kernel.project_dir%/config/crud.yml"
      - "%kernel.cache_dir%"
      - "@Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface"
      - "@translator"
      - "@crudlex.dataFactoryInterface"
      - "@crudlex.entityDefinitionFactoryInterface"
      - "@crudlex.fileSystem"
$app['crud.validateentitydefinition'] = $app['debug'];

Implementing a Custom Validator

It is possible to use your own validator by implementing the interface CRUDlexEntityDefinitionValidatorInterface and handing it in before registering the service provider:

As last argument:

crudlex.service:
    public: true
    class: "CRUDlex\\Service"
    arguments:
      - "%kernel.project_dir%/config/crud.yml"
      - "%kernel.cache_dir%"
      - "@Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface"
      - "@translator"
      - "@crudlex.dataFactoryInterface"
      - "@crudlex.entityDefinitionFactoryInterface"
      - "@crudlex.fileSystem"
      - "@crudlex.entityDefinitionValidatorInterface"
$app['crud.entitydefinitionvalidator'] = $myCustomValidator;