Questions tagged [codeigniter-datamapper]

An ORM library for CodeIgniter that builds on CodeIgniter's existing ActiveRecord library. Despite its name, it does not use the DataMapper pattern, but is instead an implementation of the ActiveRecord pattern.

DataMapper is an Object-Relational Mapper that builds on ActiveRecord. Data is loaded from database tables into objects, and relationships can be managed through simple, easy-to-read functions.

DataMapper ORM adds several important features to original DataMapper library, further enhancing it's usage, usually without requiring any code changes.

DataMapper offers these features:

  • Everything is an object!
  • Easy to setup, easy to use.
  • Custom Validation on object properties.
  • Lazy Loading (related objects are only loaded upon access).
  • Relations and their integrity are automatically managed for you.
  • One to One, One to Many, and Many to Many relations fully supported.
  • Select data in the style of Active Record (with or without Method Chaining).

Datamapper User Guide: http://datamapper.wanwizard.eu/
CodeIgniter wiki page: http://codeigniter.com/wiki/DataMapper_ORM/
Current release discussions : http://codeigniter.com/forums/viewthread/190990/

247 questions
1
vote
2 answers

Saving datamapper relationship in Codeigniter

I'm starting with Datamapper and having some errors. I thought if I create an object, a related object and then I save the relationship, both the objects were saves as well. $u = new User(); $u->where('id', $id)->get(); $p = new…
luso
  • 2,812
  • 6
  • 35
  • 50
1
vote
1 answer

How can I make the relation name independent of the related model in CI Datamapper?

When designing a relationship in Datamapper one is bound to call the relationship the same name as the related object, which is not too handy when you have something like Application_Model_User as a class name. For those of you who will rush to say…
Slavic
  • 1,891
  • 2
  • 16
  • 27
1
vote
1 answer

How do I setup super- and sub-type relationships in CodeIgnitor's DataMapper ORM?

I'm running an online food journal where users can record journal entries. There are four types of entries: food entries, exercise entries, measurements, and completed tasks. Entries have several attributes in common (e.g., id, amount, unit_id,…
1
vote
3 answers

Saving table relationships with Datamapper ORM

I am new to Object Model Mapping and just read the documentation of the CodeIgniter DataMapper. I have tried the examples and I am quite impressed in how little time one can achive a lot. But I don't seem to get one problem solved: Lets say I have…
user1036651
  • 407
  • 1
  • 5
  • 12
1
vote
1 answer

Get data from tables which are in relations

I am writing simple blog with CodeIgniter and DataMapper and I have problem with relation. How can I get posts by particularly tags with DattaMapper. SQL query will be something like that: SELECT posts.id, posts.title, posts.content, …
PaulP
  • 1,925
  • 2
  • 20
  • 25
1
vote
2 answers

Codeigniter Datamapper save as new id

I'm new to datamapper. I have a problem on trying to duplicate a result into a new id. This is a simplified table for my database: Job Table | id | property_id | name | type | | 1 | 1 | abc | i | | 2 | 2 | def | ii …
Shah Erhan
  • 573
  • 5
  • 7
1
vote
1 answer

Codeigniter Datamapper order by relation

Good afternoon, I am using Datamapper Overzealous Edition for Codeigniter to build a football league website. All of my fixtures are stored within a database table with the following format: ID Competition_id Home_team_id Away_team_id …
Daniel Greaves
  • 987
  • 5
  • 24
1
vote
2 answers

CodeIgniter Database connection on runtime

I'm still having troubles with manually connection to a database on runtime. I open a new question becuase didn't find the answer yet. Here is the case, I connect to the database with a connection user to validate a username and password that is…
Veronica
  • 41
  • 1
  • 6
1
vote
1 answer

Can I rollback a transaction after commiting it with Datamapper/Codeigniter?

Is it possible to rollback a transaction after it has been commited? I ask this because in the Datamapper documentation i see the trans_begin() method, but i didn't find the trans_end() method. Codeigniter has the trans_complete() method, so i…
Jorge Guberte
  • 10,464
  • 8
  • 37
  • 56
1
vote
1 answer

problem with advanced relationship using codeigniter and datamapper

i have three tables customer, order and user - user is the login table and customer holds address info and so on. CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `image_path`…
Chris Mccabe
  • 1,902
  • 6
  • 30
  • 61
1
vote
1 answer

Saving multiple new relations with validation (Codeigniter/DataMapper)

I am building an application with codeigniter that involves adding a "carer" with multiple telephone numbers to a database. From the UI side of things, there is an add button next to each telephone field that uses some javascript magic to clone…
Daniel Greaves
  • 987
  • 5
  • 24
1
vote
1 answer

codeigniter, datamapper and ion_auth error is leaving me confused

when i call this- $o = new Order(); codeigniter gives me this error- A PHP Error was encountered Severity: Notice Message: Undefined property: order::$ion_auth_model Filename: libraries/Loader.php Line Number: 1035 Fatal error: Call to a…
Chris Mccabe
  • 1,902
  • 6
  • 30
  • 61
1
vote
1 answer

changing object in loop in Datamapper ORM

I'm trying to save a long form in Codeigniter's Datamapper. I'm able to save the form if I pass the value like this $t->brandName = $this->input->post('brandName'); $t->specialNotes = $this->input->post('specialNotes'); $t->name =…
Mukesh Yadav
  • 2,256
  • 2
  • 33
  • 51
1
vote
1 answer

Getting as an array rather than a DataMapper ORM collection object

I am using the DataMapper ORM in my CodeIgniter project. The problem I am having is, when I use the following codes: $o = new Object(); $o->get(); The $o becomes a DataMapper ORM collection object rather than an array. I know I can still use…
bobo
  • 8,439
  • 11
  • 57
  • 81
1
vote
3 answers

How to use a Point or Geometry type in Datamapper (codeigniter)

I'm using codeigniter and datamapper to build an API service (on mysql), and part of it involves geolocation - however I can't seem to find a workaround to use the point datatype. If I try to insert GeomFromText, the system treats it as a…