[Fixed] Can ORMD support Doctrine second level cache

0 votes
asked Jun 1, 2014 in Solved by jeremiahsmall (380 points)
recategorized Oct 13, 2015 by ludek.vodicka

See Doctrine docs 35. The Second Level Cache

We're considering using this feature, which would require our xml output to look like this

Image caption

Can ORMD support this already? If not, is it something you can add support for?

commented Jun 1, 2014 by jeremiahsmall (380 points)

I'm pretty close to setting this up in my project config. Here is what it looks like (with the other customizations removed):

<ormd2-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<orm-configuration name="Doctrine2">
    <attribute-types>
        <struct name="Entity">
            <struct name="cache" help-text= "" help-url="http://doctrine-orm.readthedocs.org/en/latest/reference/second-level-cache.html">
                <attribute name="usage" type="enum" enum-values="READ_ONLY|NONSTRICT_READ_WRITE|READ_WRITE" help-text=""/>
                <attribute name="region" type="string" help-text=""/>
            </struct>
        </struct>
    </attribute-types>
</orm-configuration>
</ormd2-configuration>

The only problem is, the XML output looks something like this now

  <entity name="Db\Entity\TestOrg">
    <cache>
      <region>default_region</region>
      <usage>NONSTRICT_READ_WRITE</usage>
    </cache>
  </entity>

Actually what we need is for the properties to be attributes of cache like this

  <entity name="Db\Entity\TestOrg">
    <cache region="default_region" usage="NONSTRICT_READ_WRITE"/>
  </entity>
commented Jun 2, 2014 by Martin Freki Stradej Skipper developer (74,840 points)

It is not supported at the moment, but we are already looking onto it. It should be possible to partially implement this using custom parameters, but since it is a documented Doctrine functionality we will add full support for it to the ORM Designer.

I will let you know when the updated version is ready.

commented Jun 2, 2014 by jeremiahsmall (380 points)

Could you help me with the syntax for custom parameters? I think I'm close with my project config file (see previous post), but so far I only figured out how to get my custom attributes to be output as xml elements. What I need is a way to define custom attributes to be output as xml attributes.

1 Answer

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

This function was implemented in the version 3.0.0.1099, and released to public today.

From version 3.0, ORM Designer was renamed to Skipper. You can download Skipper from the official website:
www.skipper18.com/en/download

...