craftsmancoding / repoman

Repoman allows for easy package development in MODX Revolution. Take back the simplicity!
30 stars 7 forks source link

Unable to export TVs #31

Closed zaigham closed 9 years ago

zaigham commented 9 years ago

I am using the following command: php repoman export ../gss_my --classname=modTemplateVar --target=dev The output of this command is:

WARNING: No config.php or composer.json file detected.
[2015-05-30 00:51:10] (INFO @ repoman) Results found: 5

But I only get 1 TV exported in the target folder. I have checked the php error log, and I found this in it: PHP Fatal error: Class 'Repoman\Parser\modX' not found in /opt/bitnami/apps/modx/htdocs/packages/repoman/model/repoman/Parser/modtemplatevar.php on line 57

Kindly assist.

BTW I tried to export Templates, and they were exported as expected, even I could see some errors.

fireproofsocks commented 9 years ago

Have you pulled down the latest version of Repoman from github? If not, which version are you using?

zaigham commented 9 years ago

I am using latest, from github. Kindly see my pull request. #32

fireproofsocks commented 9 years ago

Ah, namespaces. I've merged your pull request. Thank you for contributing! Does that fix this problem?

zaigham commented 9 years ago

Apparently the initial problem is resolved, but I noticed that I get multiple slashes in the path, eg. [2015-05-30 01:23:54] (INFO @ repoman) Created static element at /opt/bitnami/apps/modx/htdocs/packages/gss_my/elements/tvs///ContentChunk.php

See double slash before ContentChunk.php

fireproofsocks commented 9 years ago

I should probably pull in the Flysystem package for better filesystem traversing... I've spotted those double slashes here and there too...

zaigham commented 9 years ago

And I am getting this warning in TV file:, see properties

<?php
return array(
    'type' => 'listbox',
    'name' => 'ContentChunk',
    'caption' => '',
    'description' => '',
    'editor_type' => 0,
    'display' => 'default',
    'default_text' => 'empty',
    'properties' => '[2015-05-30 01:42:36] (WARN @ /opt/bitnami/apps/modx/htdocs/packages/repoman/views/tv.php : 16) PHP notice: Array to string conversion
Array',
    'input_properties' => 'a:7:{s:10:"allowBlank";s:4:"true";s:9:"listWidth";s:0:"";s:5:"title";s:38:"Please choose the chunk for this page.";s:9:"typeAhead";s:5:"false";s:14:"typeAheadDelay";s:3:"250";s:14:"forceSelection";s:5:"false";s:13:"listEmptyText";s:0:"";}', // serialized
    'output_properties' => 'a:0:{}', // serialized
);
?>

The source is here: https://github.com/craftsmancoding/repoman/blob/master/views/tv.php#L16

fireproofsocks commented 9 years ago

Probably that needs to be either serialized or json_encoded (I can't remember which is used for that field), so conceivably, it could follow the input and output properties?

'properties' => '<?php print serialize($array['properties']); ?>'
zaigham commented 9 years ago

I quickly looked into database table, and I see a:0:{} as data in properties field. So this means it is serialized?

Just need to confirm because I am no php programmer :stuck_out_tongue:

fireproofsocks commented 9 years ago

Haha -- you fooled me. You've already found 3 bugs that a programmer (me) missed ;)

Yes, if you see a:0:{} that means the data is serialized. JSON encoded data would be something like {} or {"key":"value"}.

zaigham commented 9 years ago

Oh, no intentions of fooling, I just don't consider myself php programmer ;) ... (underestimating? :P)

I have added a new PR, so it will resolve it.

Thanks for nice software! Hopefully it will make life lot easier with MODX Addons/Packages.