Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileTree im MetaModel funktioniert nicht: Property not registered #215

Open
Clex1o1 opened this issue Mar 8, 2017 · 16 comments
Open

fileTree im MetaModel funktioniert nicht: Property not registered #215

Clex1o1 opened this issue Mar 8, 2017 · 16 comments
Assignees
Labels
Milestone

Comments

@Clex1o1
Copy link

Clex1o1 commented Mar 8, 2017

Hier die komplette Fehlermeldung:
Fatal error: Uncaught exception ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException with message Property atuk__mm_accessories_image is not registered. thrown in composer/vendor/contao-community-alliance/dc-general/src/ContaoCommunityAlliance/DcGeneral/DataDefinition/Definition/DefaultPropertiesDefinition.php on line 116

tritt auf wenn ich einen Ordner aufklappe.
Extensions die damit was zu tun haben könnten:

  • byteworks/metamodelsattribute_multi 1.0.4
  • menatwork/contao-multicolumnwizard 3.3.10
  • metamodels/core 2.0.0-alpha14

Wenns ein Fehler im MCW, könnt ihr uns gerne auch ne Schätzung zukommen lassen und wir beauftragen das.

Link zum ursprünglichen Ticket: https://github.com/byteworks-ch/contao-metamodelsattribute_multi/issues/3

@stefanheimes
Copy link
Member

Please try this:

  • Create a new event_listeners.php in a config folder.
  • Add this code.
  • Maybe you have to change the -50000 to a 50000
  • Test if this works for you

Good luck.

<?php

use ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\Properties\DefaultProperty;
use ContaoCommunityAlliance\DcGeneral\Factory\Event\BuildDataDefinitionEvent;

return array
(
    BuildDataDefinitionEvent::NAME => array(
        array(
            function (BuildDataDefinitionEvent $event) {
                // Get the container and all properties.
                $container = $event->getContainer();
                $properties = $container->getPropertiesDefinition();

                /** @var DefaultProperty $property */
                foreach ($properties as $property) {
                    // Only run for mcw.
                    if ('multiColumnWizard' !== $property->getWidgetType()) {
                        continue;
                    }

                    // Get the extra and make an own field from it.
                    $config = $property->getExtra();
                    foreach ($config['columnFields'] as $fieldKey => $fieldConfig) {
                        // Build the default name.
                        $name = sprintf('%s__%s', $property->getName(), $fieldKey);

                        // Make a new field and fill it with the data from the config.
                        $subProperty = new DefaultProperty($name);
                        foreach ($fieldConfig as $key => $value) {
                            switch ($key) {
                                case 'label':
                                    $subProperty->setLabel($value);
                                    break;

                                case 'description':
                                    if (!$subProperty->getDescription()) {
                                        $subProperty->setDescription($value);
                                    }
                                    break;

                                case 'default':
                                    if (!$subProperty->getDefaultValue()) {
                                        $subProperty->setDefaultValue($value);
                                    }
                                    break;

                                case 'exclude':
                                    $subProperty->setExcluded((bool)$value);
                                    break;

                                case 'search':
                                    $subProperty->setSearchable((bool)$value);
                                    break;

                                case 'filter':
                                    $subProperty->setFilterable((bool)$value);
                                    break;

                                case 'inputType':
                                    $subProperty->setWidgetType($value);
                                    break;

                                case 'options':
                                    $subProperty->setOptions($value);
                                    break;

                                case 'explanation':
                                    $subProperty->setExplanation($value);
                                    break;

                                case 'eval':
                                    $subProperty->setExtra(
                                        array_merge(
                                            (array)$subProperty->getExtra(),
                                            (array)$value
                                        )
                                    );
                                    break;

                                case 'reference':
                                    $subProperty->setExtra(
                                        array_merge(
                                            (array)$subProperty->getExtra(),
                                            array('reference' => &$subProperty['reference'])
                                        )
                                    );
                                    break;

                                default:
                            }
                        }

                        // Add all to the current list.
                        $properties->addProperty($subProperty);
                    }
                }

            },
            -500000
        )
    ),
);

@Dodger77
Copy link

Dodger77 commented May 16, 2017

Thank you very much! Works for me, but:

array('reference' => &$subProperty['reference'])

This part throws an error in MetaModels attribute editing because $subProperty is an instance of DefaultProperty, not an array.

@stefanheimes
Copy link
Member

Thanks, i will fix it. If this works for you i'll make a new version of the MCW with this fix.

@ADoebeling
Copy link

@stefanheimes Auch von meiner Seite vielen lieben Dank, wir hatten telefoniert. Ich komm spätestens auf der Contao-Konferenz hierzu nochmal auf Dich zu, Du hast was bei uns gut!

stefanheimes added a commit that referenced this issue Jun 5, 2017
Implements a event for adding alls MCW fields to the DCA. This should solve a problem with the fileTree Widget or the pageTree widget.

Moved the Event GetOptionsEvent to another folder. Add a new GetOptionsEvent Class under the MCW namespace. Mark the GetOptionsEvent in the MAW namespace as deprecated.
@stefanheimes
Copy link
Member

I have add a hotfix branch with a new version. Can u check if this is running for u.

@stefanheimes
Copy link
Member

@Dodger77 @ADoebeling ping ;)

@ADoebeling
Copy link

Mach ma!
@Dodger77 Kannst Du das mal einspielen? :)

@ADoebeling
Copy link

@stefanheimes Sorry für die späte Rückmeldung. Wie auf der #ck2017 besprochen, gibt es mit dem Patch leider noch Probleme. @Dodger77 meldet sich mit den Details.

@discordier
Copy link
Collaborator

wann?

@ADoebeling
Copy link

Ich habe heute eine Telko, da kläre ich nochmal den Status. Sorry für unsere Reaktionszeit.

@ADoebeling
Copy link

@Dodger77 wird sich hier Ende der Woche melden, wir haben gestern nochmal ein eigenes Entwicklungssystem aufgesetzt, um den aufgetretenen Fehler zu reproduzieren.

@Dodger77
Copy link

Dodger77 commented Aug 3, 2017

Ich habe nun das EInspielen des Hotfix nochmal nachgestellt und bin dabei auf folgendes Problem gestoßen:

Verschobene Klasse MenAtWork\MultiColumnWizard\Event\GetOptionsEvent



    Warning: require_once(BASEPATH//system/modules/multicolumnwizard/src/Event/GetOptionsEvent.php): failed to open stream: No such file or directory in system/modules/!metamodels-tng-branch/config/vendor_autoload.php on line 844

    #0 system/modules/!metamodels-tng-branch/config/vendor_autoload.php(844): _error(2, 'require_once(/k...', '/kunden/226796...', 844, Array)
    #1 system/modules/!metamodels-tng-branch/config/vendor_autoload.php(844): require_once()
    #2 [internal function]: autoload_446df1d8536436f29587dcf24ddac2f8('MenAtWork\Multi...')
    #3 system/modules/metamodels/classes/src/MetaModels/DcGeneral/Events/Table/DcaCombine/Subscriber.php(54): spl_autoload_call('MenAtWork\Multi...')
    #4 system/modules/metamodels/classes/src/MetaModels/DcGeneral/Events/BaseSubscriber.php(47): MetaModels\DcGeneral\Events\Table\DcaCombine\Subscriber->registerEventsInDispatcher()
    #5 system/modules/metamodels/classes/src/MetaModels/DcGeneral/Events/Subscriber.php(110): MetaModels\DcGeneral\Events\BaseSubscriber->__construct(Object(MetaModels\MetaModelsServiceContainer))
    #6 system/modules/metamodels/classes/src/MetaModels/DcGeneral/Events/Subscriber.php(50): MetaModels\DcGeneral\Events\Subscriber->registerTableMetaModelDcaCombineEvents()
    #7 system/modules/metamodels/classes/src/MetaModels/DcGeneral/Events/BaseSubscriber.php(47): MetaModels\DcGeneral\Events\Subscriber->registerEventsInDispatcher()
    #8 system/modules/metamodels/classes/src/MetaModels/BackendIntegration/Boot.php(180): MetaModels\DcGeneral\Events\BaseSubscriber->_construct(Object(MetaModels\MetaModelsServiceContainer))
    #9 system/modules/metamodels/config/event_listeners.php(68): MetaModels\BackendIntegration\Boot->perform(Object(MetaModels\Events\MetaModelsBootEvent))
    #10 [internal function]: ContaoCommunityAlliance\Contao\EventDispatcher\EventDispatcherInitializer->{closure}(Object(MetaModels\Events\MetaModelsBootEvent), 'metamodels.boot...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
    #11 system/modules/symfony-event-dispatcher/classes/EventDispatcher.php(184): call_user_func(Object(Closure), Object(MetaModels\Events\MetaModelsBootEvent), 'metamodels.boot...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
    #12 system/modules/symfony-event-dispatcher/classes/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'metamodels.boot...', Object(MetaModels\Events\MetaModelsBootEvent))
    #13 system/modules/metamodels/classes/src/MetaModels/Helper/SubSystemBoot.php(128): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('metamodels.boot...', Object(MetaModels\Events\MetaModelsBootEvent))
    #14 system/cache/config/config.php(2533): MetaModels\Helper\SubSystemBoot->boot(Object(MetaModels\MetaModelsServiceContainer))
    #15 [internal function]: Contao\Config->{closure}(Object(Pimple))
    #16 system/modules/dependency-container/classes/src/DependencyInjection/Container/ContainerInitializer.php(116): call_user_func(Object(Closure), Object(Pimple))
    #17 system/modules/dependency-container/classes/src/DependencyInjection/Container/ContainerInitializer.php(449): DependencyInjection\Container\ContainerInitializer->callHooks(Object(Pimple))
    #18 system/initialize.php(243): DependencyInjection\Container\ContainerInitializer->init()
    #19 contao/main.php(16): require('/kunden/226796...')
    #20 {main}

Anscheinend wird diese von MetaModels direkt in den Autoloader gepackt (vendor_autoload.php), so dass der verschobene Pfad Probleme bereitet hat. Als Workaround habe ich nun das Verzeichnis einfach kopiert. Damit lässt sich das aufrufen.

Bei uns hat zudem das Problem bestanden, dass die #217 mit der 3.3.11 dann auch wieder aufgetreten ist, so dass wir die Version so erst einmal nicht mit MetaModels einsetzen konnten. Dafür habe ich allerdings mittlerweile auch eine Workaround gefunden.

Als letzten (verzweifelten) Versuch hatte ich dann MetaModels aktualisiert. Das führte dann allerdings dazu, dass https://github.com/byteworks-ch/contao-metamodelsattribute_multi/ gar nicht mehr funktioniert hat.

@ADoebeling
Copy link

Contao-Version: 3.5.27

@zonky2 zonky2 removed the Accepted label Oct 7, 2017
@zonky2 zonky2 added this to the Version 3.3 milestone Oct 9, 2017
@zonky2
Copy link
Collaborator

zonky2 commented Oct 10, 2017

mit MCW 3.3.11 und contao-metamodelsattribute_multi funktioniert fast...

Beim Ändern der Dateiauswahl und schließen des Modalfensters kommt

Recoverable error: Argument 1 passed to ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\ActiveRecord::__construct() must implement interface ContaoCommunityAlliance\DcGeneral\Data\ModelInterface, null given, called in C:\Contao2Go\htdocs\vhosts\contao-3.5.x\composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat.php on line 171 and defined in composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\ActiveRecord.php on line 42
 
#0 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\ActiveRecord.php(42): __error(4096, 'Argument 1 pass...', 'C:\\Contao2Go\\ht...', 42, Array)
#1 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat.php(171): ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\ActiveRecord->__construct(NULL)
#2 composer\vendor\menatwork\contao-multicolumnwizard\system\modules\multicolumnwizard\MultiColumnWizardHelper.php(148): ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat->__get('activeRecord')
#3 system\modules\core\classes\Ajax.php(468): MultiColumnWizardHelper->executePostActions('reloadFiletree_...', Object(ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat))
#4 system\modules\core\classes\Ajax.php(198): Contao\Ajax->executePostActionsHook(Object(ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat))
#5 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Controller\Ajax.php(239): Contao\Ajax->executePostActions(Object(ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat))
#6 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\BaseView.php(387): ContaoCommunityAlliance\DcGeneral\Controller\Ajax->executePostActions(Object(ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat))
#7 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\DC\General.php(161): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\BaseView->handleAjaxCall()
#8 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\DC\General.php(104): ContaoCommunityAlliance\DcGeneral\DC_General->checkAjaxCall()
#9 system\modules\core\classes\Backend.php(408): ContaoCommunityAlliance\DcGeneral\DC_General->__construct('mm_mitarbeiterl...', Array)
#10 system\modules\core\controllers\BackendMain.php(131): Contao\Backend->getBackendModule('metamodel_mm_mi...')
#11 contao\main.php(20): Contao\BackendMain->run()
#12 {main}

man kann trotzdem die Sachen Speichern...

die Fehlermeldung beim $dc->activeRecord kommt dadurch zustande, dass im MM das $dc aus dem DC_G kommt...

@discordier
Copy link
Collaborator

Fixed in 3.3.16?

@zonky2
Copy link
Collaborator

zonky2 commented Mar 1, 2018

Test 3.3.16 + DCG b42:

Fatal error: Uncaught exception ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException with message Property my_mcw[0][mcw_filetree] is not registered. thrown in composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\DefaultPropertiesDefinition.php on line 117

#0 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\FileSelect.php(148): ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\DefaultPropertiesDefinition->getProperty('my_mcw[0][mcw_f...')
#1 system\modules\dc-general\backend\generalfile.php(43): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\FileSelect->run()
#2 {main}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants