Questions tagged [datamapper]

Architectural pattern for separating application logic from storage.

Objects and relational databases have different mechanisms for structuring data.

The Data Mapper is a layer of software that separates the in-memory objects from the database. Its responsibility is to transfer data between the two and also to isolate them from each other. With Data Mapper the in-memory objects needn't know even that there's a database present; they need no SQL interface code, and certainly no knowledge of the database schema.

Pattern definition: http://martinfowler.com/eaaCatalog/dataMapper.html

1134 questions
0
votes
1 answer

how to chop a DataMapper Collection into one Collection per day?

I have a DataMapper::Collection Object. Each of it's entries has a created_at property. I want to render the entries into html tables, one table per day (I use Sinatra for that). It was no problem to render everything into one table, but I didn't…
le_me
  • 3,089
  • 3
  • 26
  • 28
0
votes
4 answers

Tools for mapping business objects (DTO objects) from entities in asp.net mvc?

is there any tool or utility(mapper assembly) to construct business objects from entities(which are obtained from DB using linq -> sql , entity framework or whatever..) in the absence of one , can anyone suggest the best way that can be accomplished…
vijaysylvester
  • 4,750
  • 7
  • 29
  • 41
0
votes
2 answers

Ruby Datamapper model wrapped around a module prefix module name in the table name in sql query

I have a datamapper model as: module abc class Post include DataMapper::Resource property :title, String property :body, Text end end Note, my class is wrapped around module abc In other file I…
JVK
  • 3,782
  • 8
  • 43
  • 67
0
votes
1 answer

Benchmarking datamapper queries

I am using datamapper and want to benchmark some queries using ruby benchmark library. To see if it's working I started with a set, comparing methods described in datamapper docs as given below: (1..1000).each do |i| i = Item.create :name =>…
barerd
  • 835
  • 3
  • 11
  • 31
0
votes
1 answer

Why is one of my tables not being populated if I use DataMapper's "has n" and "belongs_to" methods?

I am getting to grips with DataMapper on sqlite3 at the moment. I have to models defined which are creating two tables: "companies" and "apps". Each app belongs to a company and each company many apps. I want to represent this relationship in my…
0
votes
1 answer

Attaching datamapper operator to ruby symbol and put into hash

I have: {xyz => [:abc, :klm, :nop]} I want to have something like this dynamically (22, 33, 44 are some random values): {:abc.gte => 22, :klm.gte => 33, :nop.gte => 44} gte is a Datamapper operator, as documented at…
JVK
  • 3,782
  • 8
  • 43
  • 67
0
votes
1 answer

Custom Ordering with NULL Values

I have a DataMapper class Song (through PostgreSQL) that has the following property: property :rating, Float, :required => false Users can rate songs. The problem is that I want users to browse available songs by rating. Say I have 5 songs, 3 of…
AlexQueue
  • 6,353
  • 5
  • 35
  • 44
0
votes
1 answer

Datamapper DateTime to String behaviour

I write my first project wich using Datamapper as ORM, so please be patient. :) I try to do get String from DateTime field: Error.first.submitted_at.to_s => "2009-08-24T12:13:32+02:00" Returned String is not good for me. In ActiveRecord I can do…
Sebastian
  • 2,618
  • 3
  • 25
  • 32
0
votes
1 answer

how do i map from *sql to php to javascript and back?

I write *sql / php applications a lot a I find myself having to rewrite javascript all the time to do the same stuff over and over. Usually, when the API i have to work with is very simple, its not a big deal to write one-off ajax methods to…
Kristian
  • 21,204
  • 19
  • 101
  • 176
0
votes
2 answers

gem install datamapper error

I'm trying to install datamapper and I'm getting this error: Whirlwind:Desktop AGreen$ gem install data_mapper ERROR: While executing gem ... (Errno::EACCES) Permission denied -…
skyfaerie
  • 33
  • 7
0
votes
1 answer

RangeError Exception: offset 25 and limit 25 are outside allowed range Pagination Kaminari

I am trying to paginate some items from my database however I am getting this error when I try to go onto page two of my pagination: RangeError Exception: offset 25 and limit 25 are outside allowed range This is the code in my controller that sets…
Hugs
  • 915
  • 4
  • 20
  • 47
0
votes
1 answer

How to have identity map in doctrine ORM

need to use a good PHP ORM that has elements of Datamapper and I am not clever enough to code it myself. chosen doctrine, but after reading through the user guide, cannot find anything that says how to use identity map to lower calls to…
Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
0
votes
2 answers

Ruby DataMapper doesn't store has n / belongs_to

I have two DataMapper models: class Address include DataMapper::Resource property :id, Serial property :url, String, :required => true has n, :logs end class Log include DataMapper::Resource property :id, Serial property…
ciembor
  • 7,189
  • 13
  • 59
  • 100
0
votes
1 answer

Order a merged DataMapper query and limit the number of records returned

Currently I have a query that DOES order my result set the way I want it, but I would like to limit the number of records returned. I am aware of limit in DataMapper but this has not worked for me because I am limiting each query return rather than…
Hugs
  • 915
  • 4
  • 20
  • 47
0
votes
1 answer

Can I sort records by child record count with DataMapper (without using raw SQL)?

What I want to do feels pretty basic to me, but I'm not finding a way to do it using DataMapper without resorting to raw SQL. That would look something like: select u.id, u.name, count(p.id) as post_count from posts p inner join users u on p.user_id…
Dan Tao
  • 125,917
  • 54
  • 300
  • 447