You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 relationphones
. In the first one we store information about products:price
,available_quantity
, etc. In the second we store some phone-specific data, likename
,manufacturer_id
andcolor
. Also we haveorders
andorder_items
. For OrderItem entity we want to have methods like:product_name
andprice
. The first one it should get fromproducts
relation and the second fromphones
. In result of JOIN we get new relationorder_items*
but not always we can use SQL's JOINs. When we create newOrderItem
we just use 2 other entities (their hash representations), we don't get whole hash fromorder_items*
relation so we should merge them and define accessors.The text was updated successfully, but these errors were encountered: