datamapper

Validating nested models?

To be more specific, "How do I validate that a model requires at least x valid associated models to be created?". I've been trying to validate nested models that get created in the same form as the parent (and ultimately show immediate validations a la jQuery). As a popular example, lets assume the following models and schema. class Pro...

Is there a data mapper like Dozer for c#

I am looking for something similar to Java's Dozer for C#, something that uses reflection to automatically maps the data fields in one object to another. A link to Dozer: http://dozer.sourceforge.net/ ...

Is there any PHP ORM similar to Ruby`s DataMapper ?

I working mostly with DataMapper in Ruby and Merb, so im looking for PHP ORM that is similar to DataMapper. Any good ones? ...

DataMapper has_one problem

Hello. I`m having trouble associating models in DataMapper. Its really simple, but i just can get the idea. So, i have 2 tables: 1. Books -> id -> title -> publisher_id 2. Publishers -> id -> title The classes: class Book property :id, Serial property :title, String property :publisher_id, Integer end class Publisher prope...

Need ideas for deep loading

Details: C# 2.0, SQL Server 2005 I have recently relinquished the idea that I would be able to get NHibernate working with my project. It would have worked great if I had started with it, but now it just can't adapt to my application. Which is in all honesty probably more an issue with my application that it is NHibernate. Regardless...

error happens when I try "all" method in datamapper

When I try to do this in Sinatra, class Comment include DataMapper::Resource property :id, Serial property :body, Text property :created_at, DateTime end get '/show' do comment = Comment.all @comment.each do |comment| "#{comment.body}" end end It returns this error, ERROR: undefined method `by...

Datamapper with arbitrary selects

There should be a way to map a DataMapper model against an arbitrary select (please see an example: http://www.sqlalchemy.org/docs/05/mappers.html#mapping-a-class-against-arbitrary-selects) So far I have found a solution (or a starting point to reach it) that looks like the following: find_by_sql(an_sql_select, :properties=>some_propert...

Why does DataMapper use mixins vs inheritance?

So I'm just curious about this: DataMapper uses a mixin for its Models class Post include DataMapper::Resource While active-record uses inheritance class Post < ActiveRecord::Base Does anyone know why DataMapper chose to do it that way (or why AR chose not to)? ...

how to have identity map in doctine 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 database. please show me how to have identity map in doctrine ORM? just read and understood stuff ...

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 something like that: Error.first.submitted_at.to_s(:only_date) or any other da...

Strategic Eager Loading for many-to-many relations in Datamapper?

I'm using DataMapper, an open source ORM for ruby, and I have in itch I would like to scratch. At the moment, DataMapper can use Strategic Eager Loading(SEL) for one-to-many relationships, but not many-to-many, where N+1 queries occur. I would like to hack around with making this work correctly, but I cannot find where to do it. So tw...

Tools for mapping bussiness 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 rather can copy pasting the properties(what i'm doing right now) from the entity classes...

datamapper multi-field unique index

In Datamapper, how would one specify the the combination of two fields must be unique. For example categories must have unique names within a domain: class Category include DataMapper.resource property :name, String, :index=>true #must be unique for a given domain belongs_to :domain end ...

What is the best MVC, Doctrine2, Datamapper practice?

I am looking into using Doctrine2 with my Zend Framework setup. I really like the datamapper pattern, mainly because it seperates my domain models with my database. My question is what is the best practice for using Doctrine and DQL with my controllers? controllers uses Doctrine DQL/EntityManager directly for saving/loading my domain ...

Want to sort by association records count in Datamapper

Lets say I have the following DataMapper resources: class Post include DataMapper::Resource has n, :comments ... end class Comment include DataMapper::Resource belongs_to :post ... end To get the ordered list of posts, I know you can do: @posts = Posts.all(:order => :date.desc) But lets say I want to display al...

App Engine Jruby DataMapper List Property

Hi! How to use list/array as property in DataMapper on Jruby on Google AppEngine? ...

Using Rack::Session::Datamapper

mkristgan's rack_datamapper gem says that it "can be wrapped to be used in a specific environement, i.e. Rack::Session::Datamapper". Unfortunately, I don't know quite enough about Ruby to accomplish this task yet –Modules/Classes in Ruby are still above my head (coming from PHP). Can anyone offer assistance with using rack_datamapper...

Chained aggregate call across association in DataMapper (ruby)

I am working on a simple budget app using Sinatra and DataMapper in Ruby. I want to get the sum of all transactions across all income accounts within the last 30 days. Something like Account.income_accounts.account_entries.sum(:amount, :transaction_date.gte => Date.today - 30) should work. Instead, the limiting condition on transactio...

Automatic logging of DataMapper queries

I am working on a simple app in Sinatra with DataMapper. I want to see the queries that DM is created for my various chained finders, etc. I have tried: DataMapper::Logger.new(STDOUT, :debug) in my configure do ... end block in an environment.rb file that loads when the app is started. I have also tried: DataMapper::Logger.new('...

How do I set a Data Mapper object to be accessed in view with Ocular in CodeIgniter?

Previously using Ocular 0.25 I was able to set an object as a view data, that I could access in the view: like: $b= new book(); $b->get_where("id",5); $this->ocular->set_view_data("b", $b); //could be accessed in view as $b but in the new Ocular 1.0.1, when I try to set a data mapper object it gives me a blank screen, without an...