Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Определяем базовый класс с общими атрибутами и методами
- abstract class BasicGigMigration extends Migration {
- public function __construct() {
- parent::__construct();
- $this->team = array(
- new MigrateTeamMember('Руководитель', '***@mail.ru', t('Product Owner')),
- );
- $this->issuePattern = 'http://drupal.org/node/:id:';
- Database::addConnectionInfo('for_migration', 'default', array(
- 'driver' => 'mysql',
- 'database' => '*******',
- 'username' => '*******',
- 'password' => '*******',
- 'host' => 'localhost',
- 'prefix' => '',
- ));
- }
- }
- class BankiNodeMigration extends BasicGigMigration {
- public function __construct() {
- parent::__construct();
- $this->description = t('Банки');
- // ***Схема***
- // Связь источника и цели - описание ключевых полей таблиц.
- $source_key_schema = MigrateDestinationNode::getKeySchema();
- $this->map = new MigrateSQLMap($this->machineName, $source_key_schema, MigrateDestinationNode::getKeySchema());
- // ***Источник***
- $query = Database::getConnection('default', 'for_migration')
- ->select('node', 'ns')
- ->fields('ns', array('nid', 'title', 'created', 'changed'))
- ->condition('ns.type', "banki");
- $this->source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' => false));
- // ***Цель***
- $this->destination = new MigrateDestinationNode('article');
- // ***Маппинг***
- $this->addSimpleMappings(array('nid', 'title', 'created', 'changed'));
- // *** Не сопоставленные поля***
- $this->addUnmigratedDestinations(array('vid', 'type', 'language', 'uid', 'status', 'comment', 'promote', 'sticky', 'tnid', 'translate'));
- $this->addUnmigratedSources(array('vid', 'type', 'language', 'uid', 'status', 'comment', 'promote', 'sticky', 'tnid', 'translate'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement