• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataMapper ORM v1.8.0


I haven't had a look at htmlform. It's included but unsupported since Datamapper DMZ 1.7. I haven't got a clue what it actually does...

Right-o. Htmlform is quite nice but a bit buggy, it's an amazing prototyping time-saver to be able to whack out a screen form with a few extra validation lines and a single "build the form" call.

I've solved my problem, I think, with a front-end jQuery call to $(#myfieldid).val(selected-value). Simpler than trying to dig into the guts of htmlform, at least...


trying to get started with DataMapper, I face a weird problem.

All I try to do is this in my controller:

$e = new Testy();

But I end up with an endless output of pretty much all data that exists somewhere in my code igniter folders (including language files, config file with fully readable encryption key! and so on). How is that even possible to access these files?

This is the model:


class Testy extends DataMapper {

    var $table = 'event';
    //var $has_many = array('user');
    //var $has_one = array('city');

    function Testy()
        $this->validation = array
              'field' => 'title',
              'label' => lang('wording_title'),
              'rules' => array('required'),
              'field' => 'date',
              'label' => lang('wording_date'),
              'rules' => array('required'),
              'field' => 'location_description',
              'label' => lang('wording_location_description'),
              'rules' => array('required'),
              'field' => 'datetime',
              'label' => lang('wording_datetime'),
              'rules' => array('required'),

/* End of file testy.php */
/* Location: ./application/models/testy.php */

Any idea what I might be doing wrong?

[eluser]The Hamburgler[/eluser]
momsenmeister var_dump is just doing its job, Check out the docs

[eluser]The Hamburgler[/eluser]
I'm wondering what the best way is to save a new record to a large set of related records.

I want to save a new email record to all contacts it was sent to. The email could have thousands of recipients.

get_iterated() is great as it means i can load all these records from the db without running out of memory. However, this means i cant use:

As the all array is not set for iterated objects. Is there a nice way I can save an object to an iterated related object, or should i stick to looping though the related items

foreach($contacts as $contact)

[quote author="The Hamburgler" date="1295467531"]momsenmeister var_dump is just doing its job, Check out the docs[/quote]

Thx a lot, my fault :-)

But unfortunately, I have a new question:
set_value() doesn't seem to work anymore?
I need it to repopulate my forms.

Hello everybody

Is DMZ support Single Table Inheritance?
Thank you

Endie Lo

If you refer to the way this is implemented in for example Rails, the answer is no.

I also think you should not want it, as you might collect all kind of data from the hierarchy you don't need.

Datamapper implements relations dynamically, so you get fetch a child, then use $child->parent->grandparent->get() to get related objects. You can also filter the relation using something like $child->parent->grandparent->where_related_grandparent('age', 80)->get().


Thank You for your help

I'm a beginner. I'm very love DMZ & CI

Endie Lo

Could somebody please explain me what are the cons for using this DataMapper ORM? Manual says "DataMapper is an Object Relational Mapper written in PHP for CodeIgniter. It is designed to map your Database tables into easy to work with objects, fully aware of the relationships between each other.".

Okay, but why / how is better using database as objects than making straight queries? Sorry about quite newbie questions, but i just wanted some easy examples straight queries vs. DataMapper pros / cons.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.