Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
15 / 15 |
ImageCachePreset | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
5 | |
100.00% |
15 / 15 |
query | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
fields | |
100.00% |
1 / 1 |
1 | |
100.00% |
0 / 0 |
|||
getIds | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
prepareRow | |
100.00% |
1 / 1 |
2 | |
100.00% |
10 / 10 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\image\Plugin\migrate\source\d6\ImageCachePreset. | |
*/ | |
namespace Drupal\image\Plugin\migrate\source\d6; | |
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; | |
use Drupal\migrate\Row; | |
/** | |
* Drupal 6 imagecache presets source from database. | |
* | |
* @MigrateSource( | |
* id = "d6_imagecache_presets", | |
* source_provider = "imagecache" | |
* ) | |
*/ | |
class ImageCachePreset extends DrupalSqlBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function query() { | |
$query = $this->select('imagecache_preset', 'icp') | |
->fields('icp'); | |
return $query; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function fields() { | |
$fields = [ | |
'presetid' => $this->t('Preset ID'), | |
'presetname' => $this->t('Preset Name'), | |
]; | |
return $fields; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getIds() { | |
$ids['presetid']['type'] = 'integer'; | |
return $ids; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function prepareRow(Row $row) { | |
$actions = array(); | |
$results = $this->select('imagecache_action', 'ica') | |
->fields('ica') | |
->condition('presetid', $row->getSourceProperty('presetid')) | |
->execute(); | |
foreach($results as $key => $result) { | |
$actions[$key] = $result; | |
$actions[$key]['data'] = unserialize($result['data']); | |
} | |
$row->setSourceProperty('actions', $actions); | |
return parent::prepareRow($row); | |
} | |
} |