Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有谁知道是否可以为 Doctrine 模型指定一个接口以在 YAML 中实现?
我在文档中找不到任何内容。
谢谢
我不相信有办法做到这一点。但是,您可以通过扩展学说生成的模型并在子类中实现接口来在模型中实现接口。在我看来,执行这个额外的步骤并没有损失任何价值,因为一旦你声明你正在实现一个接口,你就必须实际输入代码才能这样做。
您最好在生成的类的子类中实现接口,这样如果您重新生成该类,您的任何更改都不会丢失。