PEAR DB_DataObject实现了哪些设计模式?

时间:2021-11-22 07:17:51

DB_DataObject does not appear to be ActiveRecord because you do not necessarily store business logic in the "table" classes. It seems more like Table Data Gateway or Row Data Gateway, but I really cannot tell. What I need is good ORM layer that we can use with DataMapper and a DomainModel. Any ideas?

DB_DataObject似乎不是ActiveRecord,因为您不必将业务逻辑存储在“表”类中。它似乎更像是表数据网关或行数据网关,但我真的说不出来。我需要的是可以与DataMapper和DomainModel一起使用的良好ORM层。有任何想法吗?

2 个解决方案

#1


3  

Follow this link to read what DB_DO is. In a nutshell, it doesn't implement a specific pattern, it just aims to provide a common interface. The idea is to not rebuild the same basic code in each project.

请点击此链接阅读DB_DO。简而言之,它没有实现特定的模式,它只是旨在提供一个通用的接口。我们的想法是不在每个项目中重建相同的基本代码。

As for an ORM, I'd recommend Doctrine. It implements ActiveRecord.

至于ORM,我推荐Doctrine。它实现了ActiveRecord。

#2


1  

It sounds like what you're looking for is something like IBatis for PHP. Sadly, this doesn't yet exist. I've actually written some custom DataMapper stuff based on PDO for the current application I'm working on to achieve a persistence ignorant domain layer. It's definitely more work to develop and maintain though, so I would suggest if at all possible, go with an existing data layer implementation like Doctrine for most of your needs.

听起来你正在寻找的东西就像IBatis for PHP。可悲的是,这还不存在。我实际上已经编写了一些基于PDO的自定义DataMapper东西,用于我正在努力实现持久性无知域层的当前应用程序。尽管如此,开发和维护肯定是更多的工作,因此我建议尽可能使用像Doctrine这样的现有数据层实现来满足您的大部分需求。

#1


3  

Follow this link to read what DB_DO is. In a nutshell, it doesn't implement a specific pattern, it just aims to provide a common interface. The idea is to not rebuild the same basic code in each project.

请点击此链接阅读DB_DO。简而言之,它没有实现特定的模式,它只是旨在提供一个通用的接口。我们的想法是不在每个项目中重建相同的基本代码。

As for an ORM, I'd recommend Doctrine. It implements ActiveRecord.

至于ORM,我推荐Doctrine。它实现了ActiveRecord。

#2


1  

It sounds like what you're looking for is something like IBatis for PHP. Sadly, this doesn't yet exist. I've actually written some custom DataMapper stuff based on PDO for the current application I'm working on to achieve a persistence ignorant domain layer. It's definitely more work to develop and maintain though, so I would suggest if at all possible, go with an existing data layer implementation like Doctrine for most of your needs.

听起来你正在寻找的东西就像IBatis for PHP。可悲的是,这还不存在。我实际上已经编写了一些基于PDO的自定义DataMapper东西,用于我正在努力实现持久性无知域层的当前应用程序。尽管如此,开发和维护肯定是更多的工作,因此我建议尽可能使用像Doctrine这样的现有数据层实现来满足您的大部分需求。