change source query, got translation onprepare()
Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
0370c6233d
commit
40b0b8bae2
@ -41,17 +41,22 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
|
||||
$query_translated->join(MIG_MAT_SRC_DB_D6 .'.fr_node', 'n', 'n.nid = i.nid');
|
||||
$query_translated->join(MIG_MAT_SRC_DB_D6 .'.fr_node_revisions', 'nr', 'nr.nid = n.nid');
|
||||
|
||||
$query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_node', 'tn', 'tn.nid = i.trid');
|
||||
$query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_node_revisions', 'tnr', 'tnr.nid = tn.nid');
|
||||
// $query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_i18n_node', 'ti', 'ti.trid = i.trid');
|
||||
// $query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_node', 'tn', 'tn.nid = ti.nid');
|
||||
// $query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_node_revisions', 'tnr', 'tnr.nid = ti.nid');
|
||||
|
||||
$query_translated
|
||||
->condition('n.type',"actu")
|
||||
->condition('i.status', "0", "=")
|
||||
// ->condition('i.trid', "0", "<>")
|
||||
->fields('i', array('nid', 'trid'))
|
||||
->condition('n.type',"actu")
|
||||
// ->condition('tn.type',"actu")
|
||||
// ->condition('ti.trid', "0", "<>")
|
||||
->fields('i', array('trid'))
|
||||
->fields('n', array('nid', 'status', 'promote', 'sticky', 'created', 'changed', 'language', 'tnid'))
|
||||
->fields('nr', array('title', 'body', 'teaser', 'format'))
|
||||
->fields('tn', array('nid', 'status', 'promote', 'sticky', 'created', 'changed', 'language'))
|
||||
->fields('tnr', array('title', 'body', 'teaser', 'format'));
|
||||
->fields('nr', array('title', 'body', 'teaser', 'format'));
|
||||
// ->fields('ti', array('nid'))
|
||||
// ->fields('tn', array('nid', 'status', 'promote', 'sticky', 'created', 'changed', 'language'))
|
||||
// ->fields('tnr', array('title', 'body', 'teaser', 'format'));
|
||||
// ->orderBy('n.created', 'ASC');
|
||||
|
||||
|
||||
@ -61,20 +66,28 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
|
||||
// $query_untranslated->join(MIG_MAT_SRC_DB_D6 .'.fr_node', 'un_n', 'un_n.nid = un_i.nid');
|
||||
// $query_untranslated->join(MIG_MAT_SRC_DB_D6 .'.fr_node_revisions', 'un_nr', 'un_nr.nid = un_n.nid');
|
||||
|
||||
// $query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_i18n_node', 'un_ti', 'un_ti.nid = un_i.nid');
|
||||
// $query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_node', 'un_tn', 'un_tn.nid = un_ti.nid');
|
||||
// $query_translated->leftjoin(MIG_MAT_SRC_DB_D6 .'.fr_node_revisions', 'un_tnr', 'un_tnr.nid = un_ti.nid');
|
||||
|
||||
|
||||
// $query_untranslated
|
||||
// ->condition('un_n.type',"actu")
|
||||
// ->condition('un_i.trid', "0", "=")
|
||||
// ->fields('un_i', array('nid', 'trid'))
|
||||
// ->condition('un_n.type',"actu")
|
||||
// // ->fields('un_i', array('nid', 'trid'))
|
||||
// ->fields('un_n', array('nid', 'status', 'promote', 'sticky', 'created', 'changed', 'language', 'tnid'))
|
||||
// ->fields('un_nr', array('title', 'body', 'teaser', 'format'));
|
||||
|
||||
|
||||
// // ->fields('un_tn', array('nid', 'status', 'promote', 'sticky', 'created', 'changed', 'language'))
|
||||
// // ->fields('un_tnr', array('title', 'body', 'teaser', 'format'));
|
||||
|
||||
|
||||
// $query_translated->union($query_untranslated, 'ALL');
|
||||
|
||||
// $query = db_select($query_translated, 'x');
|
||||
|
||||
// print "\n\n- - - - - - \n\n";
|
||||
// print_r($query_translated->__toString());
|
||||
// print_r($query->__toString());
|
||||
// print "\n\n- - - - - - \n\n";
|
||||
|
||||
|
||||
@ -120,15 +133,35 @@ class MaterioBrevesNodeMigration extends MaterioBasicMigration {
|
||||
public function prepareRow($cr){
|
||||
// dsm($cr);
|
||||
print "\n- - - - - - - - \n";
|
||||
if($cr->trid){
|
||||
print "\n" . $cr->title . "\n";
|
||||
print "\n" . $cr->tnr_title . "\n";
|
||||
$cr->title = array($cr->title, $cr->tnr_title);
|
||||
|
||||
$cr->body = array($cr->body, $cr->tnr_body);
|
||||
if($cr->trid){
|
||||
$query = db_select(MIG_MAT_SRC_DB_D6 .'.fr_i18n_node', 'i');
|
||||
|
||||
$query->join(MIG_MAT_SRC_DB_D6 .'.fr_node', 'n', 'n.nid = i.nid');
|
||||
$query->join(MIG_MAT_SRC_DB_D6 .'.fr_node_revisions', 'nr', 'nr.nid = n.nid');
|
||||
|
||||
$query
|
||||
->condition('i.status', "0", "<>")
|
||||
->condition('i.trid', $cr->trid, "=")
|
||||
->fields('i', array('trid'))
|
||||
->fields('n', array('nid', 'status', 'promote', 'sticky', 'created', 'changed', 'language', 'tnid'))
|
||||
->fields('nr', array('title', 'body', 'teaser', 'format'));
|
||||
|
||||
$result = $query->execute();
|
||||
|
||||
foreach ($result as $record) {
|
||||
$tr = $record;
|
||||
}
|
||||
|
||||
print "\n" . $cr->title . "\n";
|
||||
print "\n" . $tr->title . "\n";
|
||||
|
||||
$cr->title = array($cr->title, $tr->title);
|
||||
|
||||
$cr->body = array($cr->body, $tr->body);
|
||||
// $cr->teaser = array($cr->teaser, $cr->tnr_teaser);
|
||||
|
||||
$cr->languages = array($cr->language, $cr->tn_language);
|
||||
$cr->languages = array($cr->language, $tr->language);
|
||||
}else{
|
||||
$cr->languages = $cr->language;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user