@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.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
November 30, 2011 3:43pm
Subscribe [100]#31 / Dec 07, 2011 2:51am
@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.
#32 / Dec 07, 2011 2:52am
@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.
#33 / Dec 07, 2011 2:53am
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.
#34 / Dec 07, 2011 2:57am
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.
#35 / Dec 07, 2011 3:39am
@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 :\
#36 / Dec 07, 2011 8:43am
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
?><a href="http://<?php">Continue</a><?phpThe 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?
#37 / Dec 07, 2011 9:02am
@WanWizard two things:
1) respect. this ORM is super greasy and I’m enjoying the extra lesiure time I have in my life now 😉
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
#38 / Dec 07, 2011 10:10am
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…
#39 / Dec 07, 2011 10:12am
Ya, I sort of thought that. Thanks mate, I’ll monitor this thread. Let me know if I can help.
#40 / Dec 07, 2011 10:30am
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
#41 / Dec 07, 2011 11:53am
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, download ‘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… 😉
#42 / Dec 07, 2011 12:06pm
I really can’t see what’s wrong xD
But thanks for your help anyways 😉
I hope you have time for 2 more questions ^^
First, do you know any good alternatives to your DataMapper, I can try 😉
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 😉
#43 / Dec 07, 2011 12:11pm
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 😉
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
#44 / Dec 07, 2011 12:17pm
First, do you know any good alternatives to your DataMapper, I can try 😉
No. 😊
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. 😉
There are plenty of good git tutorials online. Github also has a 101 online to get you started.
#45 / Dec 07, 2011 1:06pm
Thanks for all the response on GitHub 😉
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 😛 but if the plugin and the manual is updated? I’ll look at it once more 😛