Tables
Upload Fields
id|user_id|link|status
Upload_acc Fields
id|user_id|name|password
Upload Acc Model
var $table = 'Upload';
var $has_one = array(
'Upload_acc'=>array('class'=>'Upload_acc','other_field'=>'upload','join_table'=>'Upload_acc'),
);
How do I make this query with dm?
SELECT * FROM Upload LEFT JOIN Upload_acc ON Upload.user_id = Upload_acc.user_id WHERE Upload.status=0
I looked I could not find document.
You don’t.
Datamapper is an ORM which maintains relations between objects on primary key. You can not (mis)use it as a glorified query builder.
You can create a custom method in your Upload model, run a standard AR query in it using $this->db, and feel the result to $this->process_query(). This will convert the result of your custom query into Datamapper objects.