Created
November 28, 2012 10:11
-
-
Save alanpich/4160286 to your computer and use it in GitHub Desktop.
modMigrate ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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