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

DataMapper ORM relationships

table1(users) |ID|name |type | |1 |demo |admin | |2 |demoX |client| table2(visits) |ID|admin_id|visitor_id|visit_date|... |1 |1 |2 |2013-01-01|... admin(fk)->users(id) user(fk)->users(id) simple scheduler project, it contain 2…
Zalaboza
  • 8,899
  • 16
  • 77
  • 142
0
votes
1 answer

URL having parentheses not working in codeigniter with datamapper ORM

I'm using codeigniter with datamapper ORM, today I've noticed a strange error. I have a function named categories, which links from item page. url to category is formed using the name of the category and is encoded using rawurlencode. In category…
lightsaber
  • 1,481
  • 18
  • 37
0
votes
1 answer

Codeigniter/Datamapper not generating relationship query correctly

I have an application using Codeigniter/Datamapper. There is a table for Doctors, and a table for Specialties and the models are set up to have a many-to-many relationship. I noticed that trying to query the doctors by specialty is resulting in it…
Xylude Xaalud
  • 388
  • 1
  • 4
  • 11
0
votes
1 answer

Datamapper include_related not extending result set columns

I am using Datamapper and want to join all columns of a related table (1:1 relationship) in the result set. Hence, my code reads as follows: $p = new Project(); $arrAll = $p->where("id <", 100)->where_related('outboundform', 'reference_type',…
hofimax
  • 249
  • 1
  • 3
  • 10
0
votes
1 answer

How do i access (wanwizards) Datamapper from a library in codeigniter?

I have installed Wanwizard's Datamapper (http://datamapper.wanwizard.eu) in an empty codeigniter setup. I have no problem using datamapper in my controllers, but when I try to call datamapper objects in my libraries. I get the error: Fatal error:…
0
votes
1 answer

How to insert into a table join other table using Activerecord in CodeIgniter?

I'm new to CodeIgniter and ORM, I hope you guys can help me with this. The question table: CREATE TABLE `question` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(128) NOT NULL DEFAULT '', `content` text NOT NULL, PRIMARY…
mko
  • 21,334
  • 49
  • 130
  • 191
0
votes
1 answer

How to get table values using array and conditions

I'm studying and decided to make a CodeIgniter application with backend and frontend for learning purposes and I came across the following doubts. Would you like to get all data from a table in the database and put in an array, after that I would…
0
votes
2 answers

codeigniter datamapper get_rules not called after save()

I'm using Datamapper ORM for CodeIgniter I have rules 'serialized' and get_rules 'unserialized' for a field in my model. This field will store serialized data and when I retrieve back, get_rules will unserialize it. However, after calling save(),…
Ricky L
  • 23
  • 4
0
votes
2 answers

Using DataMapper ORM and Codeigniter to select join table value in a many to many relationship

I have this table structure: | users | --- has many > --- | preferences_users | --- < has many --- | preferences | A preference could be something like "first name" or "surname" but the value for these preferences are stored in the joining table. I…
Ian Jamieson
  • 4,376
  • 2
  • 35
  • 55
0
votes
1 answer

How to name the field one to many in Datamapper + Codeiginter

class Games{ var $has_many = array('gameSetting','team','log'); } class GameSetting {} class Team{ var $has_many = array('user','log'); } class User { var $has_many = array('log'); } class Log { } According to the official document,…
Runicer
  • 71
  • 2
  • 13
0
votes
3 answers

Does CodeIgniter Datamapper ORM support a MySQL CASE statement in ORDER BY clauses?

Using Datamapper 1.8.1-dev for PHP's CodeIgniter, I'm trying to build this query to prioritize one country name at top of the list: SELECT * FROM countries ORDER BY CASE name WHEN 'Australia' THEN 1 ELSE 2 END, name PHP on my Country model (which…
Derek MacDonald
  • 231
  • 2
  • 10
0
votes
1 answer

How to pass Model objects in CodeIgniter session from controller to controller?

I am fairly new to CI and I am working my way through a project using it. I am using CI 2.1.2 DataMapper 1.8.2.1. I am trying to post a login form to http://www.example.com/userauthcontroller/login I am able to hit the function and it authenticates…
0
votes
1 answer

Codeigniter datamapper is not loaded upon 404 overrides

When a 404 override caused by nonexistent action (only action, not controller) is being handled by Codeigniter, the datamapper fails to load, thus causing any database functionality impossible. My usage case is: I want to register data about…
Slavic
  • 1,891
  • 2
  • 16
  • 27
0
votes
2 answers

unable to install datamapper in codeigniter

I've done all the required setting but I do not know where I am going wrong. Can anybody please help me out . Its really uregent. Following is the error I am getting when I run my project. Unable to load the requested file:…
Shashi Roy
  • 323
  • 3
  • 7
  • 22
0
votes
5 answers

what is the difference between stensi & WanWizard datamaper versions?

I've tried stensi but I see it has some mistakes and unexpected output as mentioned in the user guide. For example, when trying to delete a record it gives this error: $p=new Per(); $p->where('id',1)->get(); $p->delete(); with an error message of: …