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
0 answers

Is there such a thing as a partial domain model?

I’ve built a PHP ‘personal profile based’ website that has a number of ‘Category’ pages, each of which list a number of Profiles. Category page: Lists profiles (images/names in a gallery-like layout) Profile page: Shows in-depth information about…
whoshotdk
  • 286
  • 2
  • 14
0
votes
4 answers

PHP what is the best approach to split these values up?

Having a hard time with this one as I don't think I know all of my options. I have to parse a free form text field that I need to map the values to a database. Here is some example text, NOTE: not all fields have to be there, not all delimiters are…
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
0
votes
1 answer

Displaying Bootstrap alert while saving to SQLite is successful

I want to display to user a flash/alert with proper info about the result of saving to database. I'm building a simple Sinatra app with Twitter bootstrap. ORM of choice is DataMapper and template language is HAML. This is the POST method used for…
cojoj
  • 6,405
  • 4
  • 30
  • 52
0
votes
1 answer

DataMapper use only certain columns

I have a code section like the following: users = User.all(:fname => "Paul") This of course results in getting all users called "Paul". Now I only need some of the columns available for each user which leads to replacing the above line by something…
Disenchant
  • 118
  • 4
0
votes
1 answer

Datamapper in Code Igniter deals with a relationship as many to many

I have a very confusing problem.. I configured data mapper and started to use it with code igniter.. I have this class: class FamilyMemberDetail extends DataMapper { var $table = "family_members_details"; var $has_one = array('gender',…
0
votes
1 answer

Mule - Pass Parameters to datamapper and access them in xpath conditions

How to pass parameters to datamapper in mule and access them. (In XSLT, I pass them as context parameters, receive them in param and access using $ symbol). I need to do the same thing in datamapper. Any suggestions/links/example are appreciated.…
0
votes
1 answer

datamapper in mule- facing issue to map many to single because the child elements of input are disabled

mule-datamapper: I am giving an input xml file as input.xml using this i am creating a schema and as output i am giving output xml in mule for this also i am creating xsd. Input xml:
0
votes
1 answer

Convert SQL Into Datamapper request

Is it possible to convert this SQL Query Request into Datamapper? SELECT twitchtv FROM twitchtvsts WHERE twitchtvsts.user_id = thisisavaraible get '/watch/:id' do |id| erb :mystream result = repository(:default).adapter …
user2945872
  • 393
  • 3
  • 4
  • 12
0
votes
1 answer

Class model to use in DataMapper

When implementing the DataMapper pattern, should the class model that I implement in the DataMapper package more closely resemble the domain model or the data model?
Jon
0
votes
1 answer

Sorting Datamapper ORM results through an array

I have an issue with datamapper orm and codeigniter. I have an array with person names: $names = array('john t', 'alex f', 'martin a'); Now I want to get all person who have this name: $persons = new Person(); $persons->where_in('name',…
0
votes
3 answers

Case Insensitive query in Datamapper

I am new to Datamapper. Is there any way to write case insensitive query in datamapper because I am searching for presence of a name in a table with datamapper. Normally we write query in datamapper like this say, Student.all(:name => "XYZ") where…
Joy
  • 4,197
  • 14
  • 61
  • 131
0
votes
2 answers

Are there any authentication plugins that work with DataMapper?

I'm in need of an authentication method that works with DataMapper. I can see that the authlogic plugin requires the fields crypted_password, password_salt, persistence_token in the User model. Is it enough to just add these fields to the User…
James
  • 5,273
  • 10
  • 51
  • 76
0
votes
0 answers

DataMapper method is too slow

I have two models, Show and Episode. I need to get the first unrelased or the last released episode of each Show saved in the database. I use the following method but it's terrible slow (650ms~). Have you any idea to how speed up it?…
Roxas Shadow
  • 380
  • 4
  • 8
0
votes
0 answers

Implementing "after_find" in datamapper

I've taken over porting a large application from rails 2 to rails 3. The new application uses Datamapper as its ORM (decision taken prior to me coming to the project, so I can't change this). The old application used the activerecord "after_find"…
Mikey Hogarth
  • 4,672
  • 7
  • 28
  • 44
0
votes
1 answer

DataMapper case-insensitive unique validation

I have something like: class User include DataMapper::Resource property :id, Serial property :username, String, :unique => true end post '/signup' do user = User.create(username: params['username']) if user.save puts "New user was…
slowpoke
  • 143
  • 1
  • 9