[Closed]How can I create a custom exporter?

0 votes
asked Jan 10, 2014 in Solved by fantoine (200 points)
recategorized Aug 8, 2014 by Martin Freki Stradej

I would like to extend the default Doctrine2 exporter to add support for custom annotations for my project.

If I understood correctly, the generation process uses XSLT files to translate XML files in ORMD format to PHP/YML/XML files, however I can access to XML and script files but can't find any XSLT files.
I guess they are compiled in the GFS file. Is there any way to find them? I don't feel I could create an exporter from scratch.

Thanks

1 Answer

0 votes
answered Jan 10, 2014 by Martin Freki Stradej Skipper developer (74,840 points)
selected Jul 30, 2014 by Martin Freki Stradej
 
Best answer

As you wrote, export mechanism works on XSLT basis. Also you have correctly found out that you can access XMLs, .cfgs and scripts but not .xslt files (which are compiled as GFS files). It's because we consider XSLT our critical know-how and because of that we can't provide it to public.

Also as you wrote, export works by transforming ORMD project file by several templates to desired output. You can freely add more transformations to more destinations to export script, but you can't modify existing xslt templates.

Regarding your request to extend annotations support, this isn't done by XSLT templates (as XML and YAML are) but by another complex mechanism of code parsers and generators. Currently there is support only for @ORM annotations but we have a plans to extend it to allow more customization, for example to @Gedmo annotations.

When this extension is ready, it will be possible also add more custom annotations. Unfortunately I can't promise you any specific date of release at this point.

commented Jan 10, 2014 by fantoine (200 points)

Thanks for your answer.

This kind of feature could be very interesting for a lot of people I guess. It's unfortunate you can't give us a more precise date of availability.

Is there a way to use custom annotations while keeping the compatibility with ORM Designer? I mean, are custom annotations kept while generating entites from ORM Designer?

commented Jan 13, 2014 by Martin Freki Stradej Skipper developer (74,840 points)

Yes, custom annotations are kept. Thats why annotations use different parser than XML/YAML. Only @ORM annotations are imported changed, and exported back, while the original structure of the annotations and all unsupported annotations are kept.

The only downside is that you still have to modify the custom annotations manually in the code, they are not available in the visual model (so you're still better off than completely without ORM Designer :))

...