DataMapper ORM v1.8.2 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: DataMapper ORM v1.8.2 (/showthread.php?tid=47243) |
DataMapper ORM v1.8.2 - El Forum - 04-27-2012 [eluser]WanWizard[/eluser] Depends on what your old version is, and where you upgrade to. Normally, you'll have to upgrade all Datamapper files (not only the library but also all extensions), and if you're using 1.8.2+, also the files in third_party/datamapper. DataMapper ORM v1.8.2 - El Forum - 04-27-2012 [eluser]AlexMason[/eluser] I got a join field: Code: users_groups Code: $user->group->where_join_field(...); I get this error: Code: Fatal error: Call to undefined method Group::get_join_field() in C:\xampp\htdocs\application\controllers\file.php on line 31 DataMapper ORM v1.8.2 - El Forum - 04-27-2012 [eluser]ckm5[/eluser] I've been using DMZ for a new website, successfully generating inserts, but I just ran into a problem while trying to update an existing table. I need some help figuring out if I'm doing something wrong. The error is: Code: PHP Fatal error: Call to undefined method CI_DB_mysql_driver::dm_call_method() in application/libraries/datamapper.php on line 3550 The actual call that generated this is: Code: // create customer - this works great All the table columns are valid, all the variables have values. I'm running DMZ 1.8.2 (which I just updated from 1.8 because of a bug with multiple DBs - which I use, set in datamapper config) and CI 2.1 on PHP 5.3.2 on Ubuntu 10.04.1 LTS. And, before you ask, yes DMZ is bootstrapped in index.php - I RtFM'd. And DMZ seems to work for inserts, I've been doing that for a week, just not for updates.... Thx. Chris. DataMapper ORM v1.8.2 - El Forum - 04-27-2012 [eluser]AlexMason[/eluser] Are you extending the datamapper in the model class? DataMapper ORM v1.8.2 - El Forum - 04-27-2012 [eluser]ckm5[/eluser] [quote author="AlexMason" date="1335585734"]Are you extending the datamapper in the model class?[/quote] Yup. Works fine on inserts.... Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); DataMapper ORM v1.8.2 - El Forum - 04-28-2012 [eluser]WanWizard[/eluser] @AlexMason, I need to se the exact statement to see where the join field query goes wrong. there is no get_join_field(), so the error in itself is correct. DataMapper ORM v1.8.2 - El Forum - 04-28-2012 [eluser]WanWizard[/eluser] @ckm5, If you get that error then $this->db doesn't point to Datamapper but to the original CI class. As line 3550 in my version doesn't contain a dm_call_method() call, I suggest you upgrade to the latest version first (both library, extensions and the third_party/datamapper folder) from bitbucket. DataMapper ORM v1.8.2 - El Forum - 04-28-2012 [eluser]AlexMason[/eluser] [quote author="WanWizard" date="1335605923"]@AlexMason, I need to se the exact statement to see where the join field query goes wrong. there is no get_join_field(), so the error in itself is correct.[/quote] It happens when I use where join field also: Code: public function upload() { Code: Fatal error: Call to undefined method Group::where_join_field() in C:\xampp\htdocs\application\controllers\file.php on line 31 DataMapper ORM v1.8.2 - El Forum - 04-28-2012 [eluser]WanWizard[/eluser] There's something seriously wrong with your setup. Datamapper contains a __call() magic method that will capture all calls to unknown methods, and will determine which internal methods to call. In case of where_include_field(), Datamapper will split it into a where() and a include_field() call. If __call() isn't able to map the method, it will fail with an "Unable to call the method $method on the class" exception, and not a PHP fatal error. Your User and Group models both extend Datamapper? You don't have other classes called User or Group? Do a var_dump($user) and var_dump($user->group) to make sure. and p.s.: where_join_field() requires three arguments, not only the object of the join. DataMapper ORM v1.8.2 - El Forum - 04-28-2012 [eluser]AlexMason[/eluser] Quote:Ok fixed that problem I wasn't extending datamapper in group, now the second problem arises.Figured out the problem on my own. First you need to make sure your relationship database is in order by name so groups before users. Then always remember your ->get() here is the working code I have: Code: $uid = $this->ion_auth->user()->row()->id; |