CodeIgniter Forums
DataMapper ORM v1.8.0 - 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.0 (/showthread.php?tid=37531)



DataMapper ORM v1.8.0 - El Forum - 03-20-2011

[eluser]Jean Brodeur[/eluser]
@WanWizard

Thank for the answer, i found things much more clear now.

Also, thank for this ORM, great work.

Jean


DataMapper ORM v1.8.0 - El Forum - 03-24-2011

[eluser]Syahzul[/eluser]
hi all,

i have problem with Datamapper 1.8.0 when using Modular Extensions - HMVC. i tried searching solution from this forum but found nothing (or maybe not enough searching). any help would be very appreciated.

the error:
Code:
Fatal error: Call to undefined method Welcome::get() in D:\public_html\workable\application\modules\welcome\controllers\welcome.php on line 25

controller:
Code:
class Welcome extends MX_Controller {
    /**
     * Class constructor
     */
    function __construct()
    {
        parent::__construct();
    }
    
    /**
     * Default action for this class
     */
    function index()
    {
        $w = new Welcome();
        $w->get();
    }
}

model:
Code:
class Welcome extends DataMapper {
    var $has_many = array();
}

thank you in advanced.


DataMapper ORM v1.8.0 - El Forum - 03-25-2011

[eluser]WanWizard[/eluser]
This is PHP.

You can not have two classes with the same class name (in the same namespace). So when you do 'new Welcome()', it creates a new instance of your controller, and not of the model.


DataMapper ORM v1.8.0 - El Forum - 03-25-2011

[eluser]Syahzul[/eluser]
yeah, it seems that's the problem. sorry for asking such newbie question. thank you for your reply.


DataMapper ORM v1.8.0 - El Forum - 03-28-2011

[eluser]Burton Kent[/eluser]
I'm trying to find the SQL field type of a given field. I've got code that will search fields using LIKE, however, that's not appropriate for numeric fields.

Does Datamapper store the field type somewhere so I can appropriately change the search? Or is there an easy/elegant way to get a list of field types? I'd like to avoid adding any queries I don't have to.


DataMapper ORM v1.8.0 - El Forum - 03-28-2011

[eluser]WanWizard[/eluser]
Currently, field data isn't stored in the object, only the name of the column.

If you want, you can add a feature request at http://bitbucket.org/wanwizard/datamapper/issues, so I can have a look at it when I have the time...


DataMapper ORM v1.8.0 - El Forum - 03-30-2011

[eluser]cladff[/eluser]
Hi,


i'm trying to create a function which can move up or down nodes by selecting prev or next sibilings with nested sets in Datamapper.

Code:
function move_item_menu()
    {
        $id=$this->input->post('id_item');
        $id_menu=$this->input->post('id_menu');
        $sens=$this->input->post('sens');
        
        $page=new page();
        $page->select_root($id_menu);
        $page->get_root();
        $page->get_by_id($id);
        $bro=new page();
        $bro->select_root($id_menu);
        $bro->get_root();
        $bro->get_by_id($id);
        
        if($sens=='up')
        {
            $bro->get_previous_sibling();
            $page->make_previous_sibling_of($bro);
        }
        elseif($sens=='down')
        {
            $bro->get_previous_sibling();
            $page->make_next_sibling_of($bro);
        }
    }

but unfortunaly it doesn't work.

i use multi tree options
can somebody help me please?

Thanks in advance


DataMapper ORM v1.8.0 - El Forum - 03-30-2011

[eluser]WanWizard[/eluser]
The nested_sets extension is still in an expirimental stage, and shouldn't be used in applications unless you're prepared to hunt for bugs (some have already been reported).

I haven't had the time to do that myself, more pressing issues at the moment...


DataMapper ORM v1.8.0 - El Forum - 03-31-2011

[eluser]cladff[/eluser]
Hi,

from my previous post i solved my issue!

i just saw that it was the make_previous_sibling_of which doesn't work but make_next does what i need so i turned my code into

Code:
function move_item_menu()
    {
        $id=$this->input->post('id_item');
        $id_menu=$this->input->post('id_menu');
        $sens=$this->input->post('sens');
        
        $page=new page();
        $page->select_root($id_menu);
        $page->get_root();
        $page->get_by_id($id);
        $bro=new page();
        $bro->select_root($id_menu);
        $bro->get_root();
        $bro->get_by_id($id);
        
        if($sens=='up')
        {
            $bro->get_previous_sibling();
            $bro->make_next_sibling_of($page);
        }
        elseif($sens=='down')
        {
            $bro->get_next_sibling();
            $page->make_next_sibling_of($bro);
        }
    }

for the up direction i move the previous sibling to next to the current its the same as moving current as previous ... and it workrs Smile


DataMapper ORM v1.8.0 - El Forum - 03-31-2011

[eluser]cladff[/eluser]
next issue Smile

i want to change parent of a node but it doesnt work... and same if i try last_child_of

Code:
function move_item_parent()
    {
        $id=$this->input->post('id_item');
        $id_menu=$this->input->post('id_menu');
        $id_par=$this->input->post('id_parent');
        $page=new page();
        $page->select_root($id_menu);
        $page->get_root();
        $page->get_by_id($id);
        $parent=new page();
        $parent->select_root($id_menu);
        $parent->get_root();
        $parent->get_by_id($id_par);
        
        $page->make_first_child_of($parent);        
    }

can somebody help me or direct me in a plugin which works in nested set?

datamapper is so easy to use i don't want to turn into doctrine Sad

thanks in advance