Skip to content

Instantly share code, notes, and snippets.

@alanpich
Created November 28, 2012 10:11
Show Gist options
  • Save alanpich/4160286 to your computer and use it in GitHub Desktop.
Save alanpich/4160286 to your computer and use it in GitHub Desktop.
modMigrate ideas
<?php
abstract class modMigrateObject {
/* @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; }//
/**
* 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
*
*/
}//
};// end abstract
abstract class modMigrateXMLObject extends modMigrateObject {
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