Hey,
currently I'm working in a ModX Site for a Magazine. For the Users we have a member Page where they can download the newest issues and so on. At the moment we have over 25.000 User and need for Marketing Campaigns the User Data from time to time.
The problem is now on the one side we have 4 sites of this kind with such big user databases and i want to write a simple tool to export the user data with rendered extended fields(the JSON formatted stuff) to csv File. I try to achieve this with a script i found here but it seems that such a huge database is to much for the 128mb memory in my php configuration.
I also found a snippet which is for user export and wrote a bit with the developer and he also says for his snippet its to big database.
Is there anyone out there with a affordable solution to achieve this?
I'm stuck at this point :-(
Best regards
[ed. note: dr0mfr34k last edited this post 13 years, 3 months ago.]
Do you use getResources or getIterator to fetch the results?
getIterator will be more thank likely bit slower, but does not consume memory even close to what getResources will. The syntax is same just the method name differs.
toArray( string $keyPrefix = '', boolean $rawValues = false, boolean $excludeLazy = false, boolean | integer | string | array $includeRelated = false )
$keyPrefix string
An optional prefix to prepend to the field values.
$rawValues boolean
An optional flag indicating if you want the raw values instead of those returned by the {@link xPDOObject::get()} function.
$excludeLazy boolean
An option flag indicating if you want to exclude lazy fields from the resulting array; the default behavior is to include them which means the object will query the database for the lazy fields before providing the value.
$includeRelated boolean | integer | string | array
Describes if and how to include loaded related object fields. As an integer all loaded related objects in the graph up to that level of depth will be included. As a string, only loaded related objects matching the JSON graph representation will be included. As an array, only loaded related objects matching the graph array will be included. As boolean true, all currently loaded related objects will be included.
try:
$user->toArray('',false,true);