alpacaaa / resave_entries

A simple Symphony CMS extension that let you resave your entries after structural section changes.
7 stars 6 forks source link

Resave Entries deletes out existing Reflection Field values generated by Subsection Manager on Save. #10

Open bzerangue opened 10 years ago

bzerangue commented 10 years ago

Resave Entries deleting out values Reflection Field values (that are generated from Subsection Manager using the Reflection field's XSLT utility).

When I run Resave Entries, instead of saving the Reflection Field Values, it skips over those values. Or if there is existing Reflection Field values, it empties or removes those values on Save.

To test it wasn't a Reflection field issue, I manually saved a specific entry, and it saves the value as it should.

Do you know what could be causing this?

I have used Resave Entries with a Reflection field in the past with no issue.

I am running Resave Entries, version 0.2, and running Subsection Manager 3.5.1, and Symphony 2.3.3.

Here's my reflection field utility...

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:template match="data">
      <data>
        <xsl:apply-templates select="entry" mode="search-audio-speaker-reflection"/>
    </data>
   </xsl:template>

   <xsl:template match="entry" mode="search-audio-speaker-reflection">

      <xsl:element name="search-audio-speaker">

        <!-- THIS VALUE IS COMING FROM A SUBSECTION MANAGER FIELD-->

        <xsl:value-of select="concat(speaker/item/first-name/text(),' ',speaker/item/last-name/text())"/>

      </xsl:element>

   </xsl:template>

</xsl:stylesheet>
alpacaaa commented 10 years ago

Sorry for the inconvenience Brian, haven't used this extension in a while. Would you mind sharing the PHP code you're using as a callback when resaving entries?

bzerangue commented 10 years ago

I am not using any callback php code. I am just using the default settings of the extension On Nov 1, 2013 5:32 AM, "Marco Sampellegrini" notifications@github.com wrote:

Sorry for the inconvenience Brian, haven't used this extension in a while. Would you mind sharing the PHP code you're using as a callback when resaving entries?

— Reply to this email directly or view it on GitHubhttps://github.com/alpacaaa/resave_entries/issues/10#issuecomment-27557569 .

alpacaaa commented 10 years ago

Ok fine, I'll try to fix the issue in the next few days :)

bzerangue commented 10 years ago

Thank you Marco!!! I really appreciate it On Nov 1, 2013 8:19 AM, "Marco Sampellegrini" notifications@github.com wrote:

Ok fine, I'll try to fix the issue in the next few days :)

— Reply to this email directly or view it on GitHubhttps://github.com/alpacaaa/resave_entries/issues/10#issuecomment-27564702 .

alpacaaa commented 10 years ago

I've been able to reproduce the bug, namely subsection manager isn't populating relations when loaded by reflection field. This means all the items appended to the XML by subsection manager are missing and the utility yields no result for that reason.

I can point out some references for further investigations just in case someone is willing to fix the issue (which isn't related to resave entries).

This is where the reflection field loads all the fields in a section and creates the XML: https://github.com/symphonists/reflectionfield/blob/master/extension.driver.php#L92-L98

That code calls subsection manager to generate its XML node, but no result is actually generated here: https://github.com/hananils/subsectionmanager/blob/master/fields/field.subsectionmanager.php#L676

You can see there's a little warning on top of that method, not sure if that's the cause of the problem (probably not).

Hope this helps, thanks for using resave entries!