sulu / sulu-standard

This repository is not longer the recommended way to start a sulu project. Use:
https://github.com/sulu/skeleton
MIT License
614 stars 106 forks source link

Pages not shown in select #581

Closed HellPat closed 8 years ago

HellPat commented 8 years ago

If my cache is empty, i have the select field in the backend for choosing the type of the pages. ("Kapitel" in this case)

bildschirmfoto 2016-01-03 um 16 18 47

If the cache is full, then I don't get this select anymore. I really don't know why.

bildschirmfoto 2016-01-03 um 16 15 06

If i clear my cache then it's back there for exactly one request.

HellPat commented 8 years ago

I analyzed my log files and there is the following error.

[2016-01-04 09:12:05] request.CRITICAL: Uncaught PHP Exception Sulu\Component\Content\Metadata\Factory\Exception\StructureTypeNotFoundException: "Could not load structure type "landingpage" for document type "page", looked in "/home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/DependencyInjection/../Content/templates", "/home/forge/durchblick.wacg.de/app/Resources/pages", "/home/forge/durchblick.wacg.de/app/../vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Content/templates"" at /home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Component/Content/Metadata/Factory/StructureMetadataFactory.php line 119 {"exception":"[object] (Sulu\\Component\\Content\\Metadata\\Factory\\Exception\\StructureTypeNotFoundException(code: 0): Could not load structure type \"landingpage\" for document type \"page\", looked in \"/home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/DependencyInjection/../Content/templates\", \"/home/forge/durchblick.wacg.de/app/Resources/pages\", \"/home/forge/durchblick.wacg.de/app/../vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Content/templates\" at /home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Component/Content/Metadata/Factory/StructureMetadataFactory.php:119, InvalidArgumentException(code: 0): The file \"landingpage.xml\" does not exist (in: /home/forge/durchblick.wacg.de/app/../vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Content/templates, /home/forge/durchblick.wacg.de/app/Resources/pages, /home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/DependencyInjection/../Content/templates). at /home/forge/durchblick.wacg.de/app/cache/admin/prod/classes.php:1645)"} []

My landingpage.xml looks:

<?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">

    <key>landingpage</key>

    <view>ClientWebsiteBundle:templates:landingpage</view>
    <controller>SuluWebsiteBundle:Default:index</controller>
    <cacheLifetime>2400</cacheLifetime>

    <meta>
        <title lang="de">Landingpage</title>
        <title lang="en">Landingpage</title>
    </meta>

    <properties>
        <section name="highlight">
            <properties>
                <property name="title" type="text_line" mandatory="true">
                    <meta>
                        <title lang="de">Titel</title>
                        <title lang="en">Title</title>
                    </meta>
                    <params>
                        <param name="headline" value="true"/>
                    </params>

                    <tag name="sulu.search.field" role="title"/>

                    <tag name="sulu.rlp.part"/>
                </property>

                <property name="url" type="resource_locator" mandatory="true">
                    <meta>
                        <title lang="de">Adresse</title>
                        <title lang="en">Resourcelocator</title>
                    </meta>

                    <tag name="sulu.rlp"/>
                    <tag name="sulu.search.field" role="description"/>
                </property>

                <property name="cover" type="media_selection">
                    <tag name="sulu.search.field" role="image" index="false"/>
                    <meta>
                        <title lang="de">Cover</title>
                        <title lang="en">Cover</title>
                    </meta>

                    <params>
                        <param name="types" value="image"/>
                        <param name="displayOptions" type="collection">
                        </param>
                    </params>
                </property>
            </properties>
        </section>

        <property name="smartcontent" type="smart_content">
            <meta>
                <title lang="de">Smart-Content</title>
                <title lang="en">Smart-Content</title>
            </meta>

            <params>
                <param name="max_per_page" value="5"/>

                <param name="properties" type="collection">
                    <param name="title" value="title"/>
                    <param name="article" value="article"/>
                    <param name="ext_title" value="excerpt.title"/>
                    <param name="ext_tags" value="excerpt.tags"/>
                    <param name="ext_images" value="excerpt.images"/>
                </param>
            </params>
        </property>

        <property name="publish_date" type="date">
            <meta>
                <title lang="en">Veröffentlichungsdatum</title>
                <title lang="en">Publish-Date</title>
            </meta>
        </property>
    </properties>
</template>

The Template metioned there exists.

danrot commented 8 years ago

@psren Which version are you using? I thought I have already fixed a similar bug not too long ago.

HellPat commented 8 years ago

The latest one i think:

"name": "sulu/sulu", "version": "1.1.3",

Here my complete composer.lock https://gist.github.com/psren/f4bb744cd4c8f24e9e7c

danrot commented 8 years ago

Is the landingpage.xml located in one of the folders mentioned in the error message?

HellPat commented 8 years ago

Yep. In "/home/forge/durchblick.wacg.de/app/Resources/pages". If I cat /home/forge/durchblick.wacg.de/app/Resources/pages/landingpage.xml I see the content of my file

wachterjohannes commented 8 years ago

is there also a template named ClientWebsiteBundle:templates:landingpage.html.twig in the theme which is selected in webspace?

HellPat commented 8 years ago

Yes. If I clear the cache i can See the dropdown. For exactly one request. Than it dissapears with all the other pages in the select.

wachterjohannes commented 8 years ago

and then you have an empty dropdown?

danrot commented 8 years ago

@wachterjohannes There was already a similar issue somewhere else. It was an error when writing the cache, maybe it is something similar? IIRC the templates are also cached somewhere.

wachterjohannes commented 8 years ago

this class write the class https://github.com/sulu-io/sulu/blob/develop/src/Sulu/Component/Webspace/StructureProvider/WebspaceStructureProvider.php

HellPat commented 8 years ago

@wachterjohannes yes, the first request is the first image in my ticket. If i do a second request the exact same dropdown is empty.

HellPat commented 8 years ago

@danrot which help can i provide? The issue is marked as question.

If I comment out https://github.com/sulu-io/sulu/blob/develop/src/Sulu/Component/Webspace/StructureProvider/WebspaceStructureProvider.php#L108 everything works as expected. That's not the solution for the Problem, but I don't know the system very well for now. Maybe it's a good hint for you PROs ;-)

danrot commented 8 years ago

@psren I guess for this bug @wachterjohannes is the right contact person :wink: Can you maybe post the values of the $webspaceKey and $keys variables? That would probably help :-)

HellPat commented 8 years ago

The variables are this when i comment out the cache. bildschirmfoto 2016-01-12 um 11 08 16

If the cache is enabled it breaks before this point with the Exception provided above.

wachterjohannes commented 8 years ago

this values looks good could you try to find the cached file and post it via gist?

HellPat commented 8 years ago

Which one :-) Here's a zip archive from cache/admin/dev/sulu/structures structures.zip

Many files, and all look OK on a first look.

wachterjohannes commented 8 years ago

please add also the directory cache/admin/dev/sulu/webspace_structures

HellPat commented 8 years ago

webspace_structures.zip

wachterjohannes commented 8 years ago

this seems to be correct i think! so the caching file will be written correctly.

wachterjohannes commented 8 years ago

could you post a var_dump after this line https://github.com/sulu-io/sulu/blob/develop/src/Sulu/Component/Webspace/StructureProvider/WebspaceStructureProvider.php#L80?

HellPat commented 8 years ago

If the cache is enabled it breaks before this point with the Exception provided above.

If the exception occurs this line is never reached. I paste it again:

[2016-01-04 09:12:05] request.CRITICAL: Uncaught PHP Exception Sulu\Component\Content\Metadata\Factory\Exception\StructureTypeNotFoundException: "Could not load structure type "landingpage" for document type "page", looked in "/home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/DependencyInjection/../Content/templates", "/home/forge/durchblick.wacg.de/app/Resources/pages", "/home/forge/durchblick.wacg.de/app/../vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Content/templates"" at /home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Component/Content/Metadata/Factory/StructureMetadataFactory.php line 119 {"exception":"[object] (Sulu\\Component\\Content\\Metadata\\Factory\\Exception\\StructureTypeNotFoundException(code: 0): Could not load structure type \"landingpage\" for document type \"page\", looked in \"/home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/DependencyInjection/../Content/templates\", \"/home/forge/durchblick.wacg.de/app/Resources/pages\", \"/home/forge/durchblick.wacg.de/app/../vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Content/templates\" at /home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Component/Content/Metadata/Factory/StructureMetadataFactory.php:119, InvalidArgumentException(code: 0): The file \"landingpage.xml\" does not exist (in: /home/forge/durchblick.wacg.de/app/../vendor/sulu/sulu/src/Sulu/Bundle/CoreBundle/Content/templates, /home/forge/durchblick.wacg.de/app/Resources/pages, /home/forge/durchblick.wacg.de/vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/DependencyInjection/../Content/templates). at /home/forge/durchblick.wacg.de/app/cache/admin/prod/classes.php:1645)"} []
wachterjohannes commented 8 years ago

are you available in our slack channel? or do you have skype? you can call me tomorrow and we can try to fix it with desktop sharing.

HellPat commented 8 years ago

Yep, i'll contact you tomorrow. Thanks for the help.

HellPat commented 8 years ago

I requested an invite to your slack-channel. If you prefer Skype use hellerp0507

HellPat commented 8 years ago

Okay, it seems that there was an error on my side. I tried to rebuild anything from scratch and it works there. I still don't know the error, but it works as expected now.