Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataMapper pattern for Entity #1

Open
egoholic opened this issue Mar 24, 2015 · 1 comment
Open

DataMapper pattern for Entity #1

egoholic opened this issue Mar 24, 2015 · 1 comment
Assignees

Comments

@egoholic
Copy link
Owner

We need a simple implementation of DataMapper (DM) pattern for our entities. It should provide an ability to build entities with attributes from tuples using declarative code with description of allowed for public access attributes.

For the current moment the simplest DM implementation could looks like hashes merging and defining accessors. For example, we have products relation and relation phones. In the first one we store information about products: price, available_quantity, etc. In the second we store some phone-specific data, like name, manufacturer_id and color. Also we have orders and order_items. For OrderItem entity we want to have methods like: product_name and price. The first one it should get from products relation and the second from phones. In result of JOIN we get new relation order_items* but not always we can use SQL's JOINs. When we create new OrderItem we just use 2 other entities (their hash representations), we don't get whole hash from order_items* relation so we should merge them and define accessors.

@egoholic egoholic self-assigned this Mar 24, 2015
@egoholic
Copy link
Owner Author

@SunnyMagadan , updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant