EllisLab text mark
Advanced Search
2 of 63
2
   
DataMapper ORM v1.8.2
Posted: 03 December 2011 03:34 PM   [ Ignore ]   [ # 21 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts

@azheem,

I’ve updated the example application, and added some quick fixes to the htmlform extension to make it work.

The 1.8.2 download has been updated with these fixes, download it again if you want to try the example.

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
Posted: 04 December 2011 10:38 PM   [ Ignore ]   [ # 22 ]   [ Rating: 0 ]
Avatar
Joined: 2010-05-13
8 posts

Hi i found some error after try to using example application on codeigniter 2.1.0 and datamapper 1.8.2

Fatal errorCall to undefined method CI_DB_mysql_driver::dm_call_method() in C:\wamp\www\examples\application\libraries\datamapper.php on line 1113 
 
Posted: 05 December 2011 04:49 AM   [ Ignore ]   [ # 23 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts

Then you haven’t read the docs, and didn’t install the bootstrap in your index.php file.

This is new since 1.8.2, see http://datamapper.wanwizard.eu/pages/installation.html

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
Posted: 05 December 2011 09:49 PM   [ Ignore ]   [ # 24 ]   [ Rating: 0 ]
Joined: 2011-12-05
1 posts

Same error occur:
Fatal error: Call to undefined method CI_DB_mysql_driver::dm_call_method() in C:\wamp\www\examples\application\libraries\datamapper.php on line 1113

Any work fine version with full packaged code base include CI 2.1.0 and DataMapper1.8.2 ?
We will be greatly appreciated!

 
Posted: 05 December 2011 11:10 PM   [ Ignore ]   [ # 25 ]   [ Rating: 0 ]
Joined: 2009-11-15
26 posts

You need to add

/*
 * --------------------------------------------------------------------
 * LOAD THE DATAMAPPER BOOTSTRAP FILE
 * -------------------------------------------------------------------- *
 */
require_once APPPATH.'third_party/datamapper/bootstrap.php'

directly before the

/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 *
 */
require_once BASEPATH.'core/CodeIgniter.php'

in your index.php

 
Posted: 06 December 2011 05:56 PM   [ Ignore ]   [ # 26 ]   [ Rating: 0 ]
Joined: 2011-12-06
10 posts

I thought i would just throw in the example that was in the zip when i downloaded DataMapper 1.8.2, and check out an working example to learn how to use it…. but… now I’ve tried for 3-4 hours to get it working -.-’ to find out what I’ve done wrong. Deleted everything, downloaded everything again, and copied it all ind again, many many many times. Looked through every single line in all config files, but i really can’t figure out what’s wrong -.-’

It creates the databases right, and fills some data in it, and then…
1. When I try to go forward, this shows up in the URL

hxxp://localhost/codeigniter_testing/index.php/admin/<?= site_url(‘admin/init’) ?>

annoying, but easy to jump to /admin/init.


2. On the init site where i create a user, this shows up om top of the page:

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: datamapper/htmlform.php

Line Number: 52

tried filling in the form anyways.


3. Then I get a page only with this text:

Fatal error: Uncaught exception ‘Exception’ with message ‘Unable to call the method “from_array” on the class User’ in C:\wamp\www\codeigniter_testing\application\libraries\datamapper.php:1277 Stack trace: #0 [internal function]: DataMapper->__call(‘from_array’, Array) #1 C:\wamp\www\codeigniter_testing\application\controllers\admin.php(166): User->from_array(Array, Array) #2 [internal function]: Admin->init(‘save’) #3 C:\wamp\www\codeigniter_testing\system\core\CodeIgniter.php(359): call_user_func_array(Array, Array) #4 C:\wamp\www\codeigniter_testing\index.php(203): require_once(‘C:\wamp\www\cod…’) #5 {main} thrown in C:\wamp\www\codeigniter_testing\application\libraries\datamapper.php on line 1277

 

This is really really pissing me off xD I thought I was about to learn about the DataMapper, but ended up using 3-4 hours trying to get the example working, without luck -.-’ Really hope someone can help me xD

 
Posted: 06 December 2011 06:30 PM   [ Ignore ]   [ # 27 ]   [ Rating: 0 ]
Joined: 2011-07-15
16 posts

GREAT JOB WanWizard! I have been waiting for this update.

I follow the install tutorial and it worked out of the box with no issues, and we have a decent size system.

One question tho, I know CI 2.1 now has a PDO driver. Does ORM works with PDO? If that is the case, how? I tried just changing the driver to ‘pdo’. in the ci database.php config file.

But I get this error message

Uncaught exception ‘PDOException’ with message ‘invalid data source name’ in ...

 

 
Posted: 06 December 2011 07:50 PM   [ Ignore ]   [ # 28 ]   [ Rating: 0 ]
Avatar
Joined: 2010-05-13
8 posts
WanWizard - 05 December 2011 04:49 AM

Then you haven’t read the docs, and didn’t install the bootstrap in your index.php file.

This is new since 1.8.2, see http://datamapper.wanwizard.eu/pages/installation.html

thank’s works for me. Just some advice, maybe you should update the offline documentation. :D

 
Posted: 06 December 2011 07:53 PM   [ Ignore ]   [ # 29 ]   [ Rating: 0 ]
Avatar
Joined: 2010-05-13
8 posts

Can I combine this plugin with ionAuth? I see the structure of database table seems same. any suggestion where I’m start

 
Posted: 07 December 2011 03:51 AM   [ Ignore ]   [ # 30 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts

@Martin Dilling,

When did you download? Download it again, I’ve updated the example application a few days ago, to make it work with CI 2+, and I also removed all short tags.

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
Posted: 07 December 2011 03:52 AM   [ Ignore ]   [ # 31 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts

@Onema,

DataMapper uses CI’s database layer, so anything that works with CI (and it’s active record implementation) should also work with DataMapper.

The error is very clear though: “invalid data source name”. For the PDO driver, you have to define a dsn.

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
Posted: 07 December 2011 03:53 AM   [ Ignore ]   [ # 32 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts
elmizan - 06 December 2011 07:50 PM

thank’s works for me. Just some advice, maybe you should update the offline documentation. :D

What do you mean by ‘offline documentation’?

The manual on the website should be exactly the same as in the repository and the download files, as the website is directly updated from bitbucket.

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
Posted: 07 December 2011 03:57 AM   [ Ignore ]   [ # 33 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts
elmizan - 06 December 2011 07:53 PM

Can I combine this plugin with ionAuth? I see the structure of database table seems same. any suggestion where I’m start

DataMapper doesn’t supply any tables, so I’m not sure what you mean.

But in general it is no problem mixing normal CI active record calls and using a DataMapper model to interact with the table. You only have to make sure the relation structure isn’t broken (foreign keys updated/reset/etc) when you access the tables directly.

For complex operations, I normally use direct AR calls in my DataMapper model methods, as they are faster that ORM operations. If needed DataMapper provides a method to convert a standard CI $this->db result into DataMapper objects.

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
Posted: 07 December 2011 04:39 AM   [ Ignore ]   [ # 34 ]   [ Rating: 0 ]
Joined: 2011-12-06
10 posts

@WanWizard, as I wrote I downloaded the newest version of both CI and DataMapper many times in the 2-3 hours before my post? Is it updated since then :\

 
Posted: 07 December 2011 09:43 AM   [ Ignore ]   [ # 35 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4404 posts

Ok, had some time to look at the code, and I indeed missed one line in my conversion:

in controllers/admin.php, line 65 should read

?><p><a href="<?php echo site_url('admin/init'); ?>">Continue</a></p><?php 

The other error (method from_array() not found) means the array extension isn’t loaded. Did you copy the config/datamapper.php file from the example application to your application config folder? Because that is where it is defined.

If you config/datamapper.php file contains

$config['extensions'= array('array'); 

does your application folder contain a folder called “datamapper”, and does that contain a file called “array.php”, and is this file readable for your webserver?

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM

 
2 of 63
2