EllisLab text mark
Advanced Search
3 of 63
3
   
DataMapper ORM v1.8.2
Posted: 07 December 2011 03:52 AM   [ Ignore ]   [ # 31 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4405 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
4405 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
4405 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
4405 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

 
Posted: 07 December 2011 10:02 AM   [ Ignore ]   [ # 36 ]   [ Rating: 0 ]
Joined: 2010-12-21
25 posts

@WanWizard two things:

1) respect. this ORM is super greasy and I’m enjoying the extra lesiure time I have in my life now wink

2) I think the ‘field_data’ function is being called by the default DB connection.  You see at line 645 we have

// Get and store the table's field names and meta data
$fields $this->db->field_data($this->table); 

In my instance, I have two DB configs defined

$db['default']['dbdriver''mysql'

and

$db['mssql2008']['dbdriver''mssql'

My setup works until I get to a model that is based on a table from the MS SQL DB; I am setting said model like this:

var $db_params 'mssql2008'

and I receive the error

Table ‘MyDatabase.tableName’ doesn’t exist
DESCRIBE `tableName`

And, of course, you can see from the DESCRIBE and the `backticks` that it is indeed using the DB functions defined by the MySQL driver (my default driver).

Rather than mucking about and making a total mess of your library, I thought I’d see if you agree with my analysis and if so, is there a quick fix for this?

Kind regards,
diZz

 
Posted: 07 December 2011 11:10 AM   [ Ignore ]   [ # 37 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4405 posts

That should not be the case.

$this->db is defined by the __get() magic method, when it is first used, but only if it hasn’t been defined in the model any other way.

In the __get() method, the value of db_params is checked, and in case of a string value, it will call $CI->load->database($this->db_params, TRUE, TRUE) which looks ok to me.

I’m in no position to test at the moment, I can see if I can squeeze a test in tonight…

 Signature 

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

 
Posted: 07 December 2011 11:12 AM   [ Ignore ]   [ # 38 ]   [ Rating: 0 ]
Joined: 2010-12-21
25 posts

Ya, I sort of thought that.  Thanks mate, I’ll monitor this thread.  Let me know if I can help.

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

Got the two shorttags fixed. And everything is set as you said it should be.
But I still get these two errors, the first one, when I use the search, and the second every time the page shows a form :\
http://i42.tinypic.com/al6jhk.png

 
Posted: 07 December 2011 12:53 PM   [ Ignore ]   [ # 40 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4405 posts

The search doesn’t give me problems here, with exactly the same URL. I tried with CI 2.0.3, 2.1.0 and reactor.

The other one is fixed (and I found one more that has been fixed).

You can download the updates from https://bitbucket.org/wanwizard/datamapper/downloads downl,oad ‘tip’ under Tags.

I like to stress that this code hasn’t been maintained for 18 months, and was only compatible with CI 1.7. I’ve tried to make it work due to popular demand, but there might be more issues lurking in the code… wink

 Signature 

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

 
Posted: 07 December 2011 01:06 PM   [ Ignore ]   [ # 41 ]   [ Rating: 0 ]
Joined: 2011-12-06
10 posts

I really can’t see what’s wrong xD
But thanks for your help anyways wink

I hope you have time for 2 more questions ^^
First, do you know any good alternatives to your DataMapper, I can try wink

and second, and not related to anything CI xD But do you by any chance know any good tutorials or any help on working with GitHub or other good alternatives for online backup and version managing wink

 
Posted: 07 December 2011 01:11 PM   [ Ignore ]   [ # 42 ]   [ Rating: 0 ]
Avatar
Joined: 2008-10-15
147 posts
Martin Dilling - 07 December 2011 01:06 PM

Do you by any chance know any good tutorials or any help on working with GitHub or other good alternatives for online backup and version managing wink

Some nice Git help and articles:
http://progit.org/book/
http://www.vogella.de/articles/Git/article.html
http://sandofsky.com/blog/git-workflow.html
http://nfarina.com/post/9868516270/git-is-simpler

 
Posted: 07 December 2011 01:17 PM   [ Ignore ]   [ # 43 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4405 posts
Martin Dilling - 07 December 2011 01:06 PM

First, do you know any good alternatives to your DataMapper, I can try wink

No. smile

But if your only selection criteria is an old and outdated piece of example code that hasn’t been supported for two years, which is based on an extension that isn’t supported anymore since v1.7.1, then maybe you should try a little harder. wink

There are plenty of good git tutorials online. Github also has a 101 online to get you started.

 Signature 

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

 
Posted: 07 December 2011 02:06 PM   [ Ignore ]   [ # 44 ]   [ Rating: 0 ]
Joined: 2011-12-06
10 posts

Thanks for all the response on GitHub wink

I didn’t know the example was outdated xD must have missed that somewhere xD
I just have easier to learn by looking on full examples, than reading a manual raspberry but if the plugin and the manual is updated? I’ll look at it once more raspberry

 
Posted: 07 December 2011 06:44 PM   [ Ignore ]   [ # 45 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4405 posts

The manual is fully up to date.

I should find the time to bring the example up to date, it is still build using a lot of PHP4 techniques, common in the CI 1.6-1.7 days. All I did was a quick scan for obvious issues, like PHP short tags.

 Signature 

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

 
3 of 63
3