Symfony 6.3 中的新功能:序列化程序调试命令【转载】 CJayhe Symfony博客 311 views 序列化[程序组件](https://symfony.com/serializer)处理数据结构的(反)序列化, 包括对象图,转换为数组结构或其他格式,如XML和JSON。 这是一个强大的组件,但它的大部分复杂性都是隐藏的,这使得它 难以调试复杂情况。 在Symfony 6.2中,我们在[Symfony分析器](https://symfony.com/doc/current/profiler.html)中添加了一个新的序列化程序面板 帮助调试问题。在Symfony 6.3中,我们添加了另一个工具来帮助你:**新的[debug:serializer]()命令**。 此命令转储给定类的序列化程序元数据,这有助于 查找元数据配置中的任何问题: ```shell php bin/console debug:serializer 'App\Entity\Book' App\Entity\Book --------------- +----------+------------------------------------------------------------+ | Property | Options | +----------+------------------------------------------------------------+ | name | [ | | | "groups" => [ | | | "book:read", | | | "book:write", | | | ] | | | "maxDepth" => 1, | | | "serializedName" => "book_name" | | | "ignore" => false | | | "normalizationContexts" => [], | | | "denormalizationContexts" => [] | | | ] | | isbn | [ | | | "groups" => [ | | | "book:read", | | | ] | | | "maxDepth" => null, | | | "serializedName" => null | | | "ignore" => false | | | "normalizationContexts" => [], | | | "denormalizationContexts" => [] | | | ] | +----------+------------------------------------------------------------+ ``` 此命令加入了 Symfony 提供的其他内置命令, 总共 12 个命令:debug ```shell debug:config "Dump the current configuration for an extension" debug:container "Display current services for an application" debug:autowiring "List classes/interfaces you can use for autowiring" debug:dotenv "Lists all dotenv files with variables and values" debug:event-dispatcher "Display configured listeners for an application" debug:router "Display current routes for an application" debug:serializer "Display serialization information for classes" debug:translation "Display translation messages information" debug:validator "Display validation constraints for classes" debug:form "Display form type information" debug:firewall "Display information about your security firewall(s)" debug:twig "Show a list of twig functions, filters, globals and tests" ``` 原文链接 https://symfony.com/blog/new-in-symfony-6-3-serializer-debug-command 帮助PHPZlc项目! 与任何开源项目一样, 贡献代码 或 文档 是最常见的帮助方式, 但我们也有广泛的 赞助机会。 0 赞赏 加入技术群 评论 去登录