-
Notifications
You must be signed in to change notification settings - Fork 7
export
Export MODX elements and objects from MODX into your repository. This functionality makes it easier for you to transition into using Repoman. You can grab existing MODX data and make it a part of your package.
For Elements (Snippets, Chunks, Templates, Plugins, and TVs), this will create a static version of the Element with the source content in your local repository. For other objects (e.g. System Settings), this will save a copy of the object as an array in your local repository.
php repoman export <pkg_root_dir> --classname=<classname> --where=<json_criteria>
--classname (string)
Required: you must specify which type of object you are exporting.
--where (json)
This parameter allows you to specify the search criteria for your export. If omitted, getCollection
is run without any filter parameters.
--move (boolean, default false)
Affects only elements: if set, the original element will be updated to be a static element
with its source in the new location. If not set, a "snapshot" copy of the element is created
and the original is left untouched.
--target (string, required)
Specify which seed directory where your exported files will be written, relative to your seeds_dir.
--package (string)
Syntax is a colon-sparated string:
:model/:
It's recommended that you instead set the "packages" array in your config.php. See example below.
If you have customized the "orm_path" setting, make sure the paths here reflect that!
--limit (integer)
Because recordsets may be large, seed files are limited to a given number of records. If you find
that too many seed files are being created, then increase this number. If your records are so large
that PHP is having a hard time writing or slurping the files, decrease this number.
Default: 50
--debug (boolean, default false)
If set, no action is taken, but the raw SQL query will be returned including a list
of results found.
Because its laborious to pass the package parameter via the command-line, it's recommended that you set the "packages" array in your composer.json, e.g.
"packages":[
{
"pkg":"moxycart",
"path":"model/",
"table_prefix": "moxy_"
}
]
php repoman export /path/to/my/repo --classname=modTemplate '--where={"templatename":"Home Page"}' --target=dev
php repoman export /path/to/my/repo --classname=modTemplate '--where={"templatename:IN":["Home Page","Contact"]}' --target=dev
php repoman export /path/to/my/repo --classname=modPlugin '--graph={"Events":{}}' '--where={"name":"Bloodline"}' --target=prod
php repoman export /path/to/my/repo --classname=modResource ''--where={"id:IN":["100","201"]}' --target=dev
See Also: http://rtfm.modx.com/xpdo/2.x/class-reference/xpdoquery/xpdoquery.where
© 2014 and beyond by Craftsman Coding