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/

248 questions
11
votes
1 answer

DataMapper ORM vs. Doctrine

I'm about to start developing a new web application in CodeIgniter. In the past, I have used DataMapper ORM for my object mapping needs and have been completely satisfied with it's capabilities. However, my satisfaction only goes as far as my…
Jordan Arseno
  • 6,487
  • 7
  • 48
  • 94
8
votes
6 answers

class name collision when using codeigniter 2.0 with Datamapper?

I am using CI2.0 with PHP 5.3 I just started to use “Datamapper ORM” and it is excellent!! however their is a one big problem regarding the classes’ names I have a database table called “users” so my dm model is “user” and also I have a controller…
ahmed
  • 13,938
  • 28
  • 87
  • 124
6
votes
6 answers

Error: You must use the "set" method to update an entry fix?

I am using codeigniter as my PHP framework, and I keep getting this error when I submit my from to post to my database. You must use the "set" method to update an entry I am not exactly sure what that means, from the other posts I have looked at,…
ddrossi93
  • 366
  • 2
  • 6
  • 17
5
votes
1 answer

CodeIgniter/Datamapper: Two one-to-many relationships to the same table not working

I'm having this problem with relationships with Codeigniter's DataMapper. I have an Interview model that has an author_id and an interviewee_id. They both relate to the user id in the user model. I've been trying several approaches and none work;…
Nelo
  • 137
  • 8
5
votes
3 answers

how to count the number of rows returned by query in Codeigniter with Datamapper

I am using the following query in controller of codeigniter. $u -> where('us_email_id', $username); $u -> where('us_password', $password1); $details = $u -> get(); $total = count($details); echo $total; echo "
"; echo…
4
votes
2 answers

Using an aliased field in a CodeIgniter DataMapper ORM many-to-one relationship

I'm currently modeling out a website using the DataMapper ORM for CodeIgniter. At the moment, I have a users table that has all the standard user information, including an id, and a form_data table that has its own id and a field called created_by…
treeface
  • 12,934
  • 3
  • 48
  • 57
4
votes
3 answers

DataMapper ORM for Codeigniter Relations

I have a table ... CREATE TABLE IF NOT EXISTS `messages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `to` int(11) NOT NULL, `from` int(11) NOT NULL, `subject` varchar(50) NOT NULL, `message` varchar(1000) NOT NULL, PRIMARY KEY (`id`) )…
nomie
  • 199
  • 1
  • 2
  • 14
4
votes
2 answers

CodeIgniter DataMapper ORM v1.8.0 - How to Get records from multiple tables

I am new to this and need a little help. I have a 2 tables... CREATE TABLE `vehicles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `vehicle_type` varchar(50) NOT NULL, `vehicle_make` varchar(50) NOT NULL, `vehicle_model` varchar(50) NOT NULL, …
nomie
  • 199
  • 1
  • 2
  • 14
3
votes
1 answer

Find duplicate records with advanced query in CodeIgniter Datamapper

I'm trying to get all duplicate rows from a DB. Lets say I have table entries with primary key id ant VARCHAR column called name. I already have a working SQL query: SELECT id, entries.name FROM entries INNER JOIN (SELECT name FROM entries …
package
  • 4,621
  • 23
  • 34
3
votes
5 answers

Compare two dates in Codeigniter and MySQL

How can I get values between two dates in Codeigniter query function? Here is my model and sample code. function get_promo() { $today = date('Y-m-d'); $query = $this->db->query('SELECT FROM tbl_event WHERE event_id = $id AND event_startdate…
idontknowhow
  • 1,417
  • 4
  • 17
  • 23
3
votes
2 answers

Using DataMapper ORM for php to map field names

I'm looking at using DataMapper ORM with CodeIgniter, but have a scenario where the database structure is poorly formed. I'd like to be able to configure my model to map the database field names, to something more logical. Then, when we get around…
mattdwen
  • 4,878
  • 10
  • 44
  • 60
3
votes
6 answers

Creating nested relationships with an ORM and minimizing queries

Edit 3 After reading a boat load I really don't think with any ORM or system in general it is possible to build the relationships of organized objects like I want in fewer queries that I am using. If any can provide an example of it being possible I…
austinbv
  • 8,683
  • 6
  • 42
  • 78
3
votes
2 answers

Codeigniter HMVC and datamapper compatibility

I am new to Codeigniter and I am thinking about the use of this framework in my new project. I am going to need these two extensions. Before digging into too deep, I wonder if anyone already has experience with them and can kindly give some insights…
bobo
  • 7,641
  • 10
  • 54
  • 80
3
votes
1 answer

How Edit record using Codeigniter

I am trying to edit my db record using codeigniter but I can't do it and what's the problem I didn't understand. Please help. Here is my controller code : public function edit() { …
Xubayer pantho
  • 309
  • 5
  • 11
  • 27
3
votes
1 answer

CodeIgniter DataMapper Error: You must use the "set" method to update an entry

I'm using codeigniter/datamapper to develop an inviocing application and I'm getting an error that i don't understand. If I do the following: $i = new Invoice(); $i->save(); Then i get the following error: A Database Error Occurred You must…
jx12345
  • 1,520
  • 1
  • 20
  • 39
1
2 3
16 17