Skip to content

Instantly share code, notes, and snippets.

@silentworks
Forked from alanpich/modMigrate.php
Created November 28, 2012 10:24
Show Gist options
  • Save silentworks/4160338 to your computer and use it in GitHub Desktop.
Save silentworks/4160338 to your computer and use it in GitHub Desktop.
modMigrate ideas
<?php
abstract class pmsMigrateObject {
/* @var object Object Properties */
private $data;
/* @var string MODx Class Name */
private $classKey;
/* @var string Migrate ID */
private $migrateId;
/* @var int MODx Object pk */
private $localId;
/**
* Load self::$data from file
* @param string $path Path to file
* @return boolean Success
*/
public function fromFile( string $path ){ return true; }
/**
* Write self::$data to file
* @param string $path Path to file
* @return boolean Success
*/
public function toFile( string $path ){ return true; }
/**
* Get the migrate_id
* @return string Migrate Id
*/
public function getMigrateId(){ return $this->migrateId; }
public function up() {}
public function down() {}
/**
* Get the MODx PK id
* @return int MODx PK id
*/
public function getLocalId(){
/**
* Connect to modx db migrate table
*
* Match migrateId to classKey|localId
*
* If not found in local instance, create new object
* and save new localId
*
*/
}
}
class pmsMigrateXMLObject extends pmsMigrateObject {
public function fromFile($path){
/**
* Load from xml file format
*
* Populate self::$data with properties
*
* Populate self::$migrateId from data file
*
*/
}
public function toFile($path){
/**
* Write self::$data to flat file
*
* File should include self::classKey
*
* File should include self::migrateId
*
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment