统一访问对象
这个问题基于 facebook graph api...facebook 能够从单个 URI 访问对象(用户、页面、事件)...(graph.facebook.com/ID)。我如何使用 neo4J 来完成此任务?我的计划是将每个节点类型(用户、页面、事件)包装在一个 php 对象中,然后统一访问所有对象......
This question is base on the facebook graph api...facebook is able to access objects (User, Page, Event) from a single URI...(graph.facebook.com/ID). How can I accomplish this using and neo4J? my plan is wrap each node type(User, Page, Event) in a php object then access all objects uniformly....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,您希望有一种统一的方式对一组不同类型的对象执行常见操作?
要在 PHP 中做到这一点,我会做两件事 - 编写一个定义公共操作的接口,然后编写代理类,就像您提到的那样,包装原始对象并实现该接口。
例如,如果您有这些类:
您可以编写一个接口和两个代理类,如下所示:
然后您可以编写在 FacebookObject 代理上运行的代码:
If I understand you correctly, you want to have a uniform way to perform common operations on a set of objects of different type?
To do that in PHP, I would do two things - write an interface that defines the common operations, and then write proxy classes that, just like you mention, wrap the original objects and implement the interface.
For example, if you have these classes:
You could write an interface and two proxy classes like this:
And then you can write code that operates on the FacebookObject proxy: