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

FR: Item persister and retriever #1097

Closed
zonky2 opened this issue Mar 17, 2017 · 8 comments
Closed

FR: Item persister and retriever #1097

zonky2 opened this issue Mar 17, 2017 · 8 comments
Assignees
Labels
bug A bug! A bug! Fast, squish it! enhancement This issue is about an enhancement (aka new feature)
Milestone

Comments

@zonky2
Copy link
Contributor

zonky2 commented Mar 17, 2017

Check https://github.com/MetaModels/core/tree/feature/item-persister-and-retriever

@zonky2 zonky2 added the enhancement This issue is about an enhancement (aka new feature) label Mar 17, 2017
@zonky2 zonky2 added this to the 2.0.0 milestone Mar 17, 2017
@zonky2
Copy link
Contributor Author

zonky2 commented Mar 17, 2017

dev-feature/item-persister-and-retriever (b63bd7e)

Update or New and save item at BE:

Warning: sprintf(): Too few arguments in composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php on line 218

#0 [internal function]: __error(2, 'sprintf(): Too ...', 'C:\\Contao2Go\\ht...', 218, Array)
#1 composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php(218): sprintf('UPDATE %1$s %%s...', 'mm_mitarbeiterl...', '?')
#2 composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php(99): MetaModels\DataAccess\ItemPersister->saveRawColumns(Array, Array)
#3 composer\vendor\metamodels\core\src\MetaModels\MetaModel.php(429): MetaModels\DataAccess\ItemPersister->saveItem(Object(MetaModels\Item))
#4 composer\vendor\metamodels\core\src\MetaModels\Item.php(324): MetaModels\MetaModel->saveItem(Object(MetaModels\Item))
#5 composer\vendor\metamodels\core\src\MetaModels\DcGeneral\Data\Driver.php(582): MetaModels\Item->save()
#6 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask.php(630): MetaModels\DcGeneral\Data\Driver->save(Object(MetaModels\DcGeneral\Data\Model))
#7 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask.php(725): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask->doPersist()
#8 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ActionHandler\EditHandler.php(76): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask->execute()
#9 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\View\ActionHandler\AbstractHandler.php(54): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ActionHandler\EditHandler->process()
#10 [internal function]: ContaoCommunityAlliance\DcGeneral\View\ActionHandler\AbstractHandler->handleEvent(Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#11 composer\vendor\symfony\event-dispatcher\EventDispatcher.php(184): call_user_func(Array, Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#12 composer\vendor\symfony\event-dispatcher\EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#13 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Controller\DefaultController.php(152): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#14 composer\vendor\metamodels\core\src\MetaModels\BackendIntegration\Module.php(74): ContaoCommunityAlliance\DcGeneral\Controller\DefaultController->handle(Object(ContaoCommunityAlliance\DcGeneral\Action))
#15 system\modules\core\classes\Backend.php(423): MetaModels\BackendIntegration\Module->generate()
#16 system\modules\core\controllers\BackendMain.php(131): Contao\Backend->getBackendModule('metamodel_mm_mi...')
#17 contao\main.php(20): Contao\BackendMain->run()
#18 {main}


Fatal error: Uncaught exception Exception with message Empty query string thrown in system\modules\core\library\Contao\Database\Statement.php on line 145

#0 system\modules\core\library\Contao\Database.php(181): Contao\Database\Statement->prepare(false)
#1 composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php(219): Contao\Database->prepare(false)
#2 composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php(99): MetaModels\DataAccess\ItemPersister->saveRawColumns(Array, Array)
#3 composer\vendor\metamodels\core\src\MetaModels\MetaModel.php(429): MetaModels\DataAccess\ItemPersister->saveItem(Object(MetaModels\Item))
#4 composer\vendor\metamodels\core\src\MetaModels\Item.php(324): MetaModels\MetaModel->saveItem(Object(MetaModels\Item))
#5 composer\vendor\metamodels\core\src\MetaModels\DcGeneral\Data\Driver.php(582): MetaModels\Item->save()
#6 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask.php(630): MetaModels\DcGeneral\Data\Driver->save(Object(MetaModels\DcGeneral\Data\Model))
#7 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask.php(725): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask->doPersist()
#8 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ActionHandler\EditHandler.php(76): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask->execute()
#9 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\View\ActionHandler\AbstractHandler.php(54): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ActionHandler\EditHandler->process()
#10 [internal function]: ContaoCommunityAlliance\DcGeneral\View\ActionHandler\AbstractHandler->handleEvent(Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#11 composer\vendor\symfony\event-dispatcher\EventDispatcher.php(184): call_user_func(Array, Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#12 composer\vendor\symfony\event-dispatcher\EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#13 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Controller\DefaultController.php(152): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#14 composer\vendor\metamodels\core\src\MetaModels\BackendIntegration\Module.php(74): ContaoCommunityAlliance\DcGeneral\Controller\DefaultController->handle(Object(ContaoCommunityAlliance\DcGeneral\Action))
#15 system\modules\core\classes\Backend.php(423): MetaModels\BackendIntegration\Module->generate()
#16 system\modules\core\controllers\BackendMain.php(131): Contao\Backend->getBackendModule('metamodel_mm_mi...')
#17 contao\main.php(20): Contao\BackendMain->run()
#18 {main}

at New we have an empty new item

@zonky2
Copy link
Contributor Author

zonky2 commented Mar 17, 2017

published/unpublished per "green eye" doesn´t works - Ajax send same error as #1097 (comment)

@zonky2
Copy link
Contributor Author

zonky2 commented Mar 17, 2017

after MM update:

Update or New and save item at BE:


#0 system\modules\core\library\Contao\Database\Statement.php(262): Contao\Database\Statement->replaceWildcards(Array)
#1 composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php(221): Contao\Database\Statement->execute(Array)
#2 composer\vendor\metamodels\core\src\MetaModels\DataAccess\ItemPersister.php(99): MetaModels\DataAccess\ItemPersister->saveRawColumns(Array, Array)
#3 composer\vendor\metamodels\core\src\MetaModels\MetaModel.php(429): MetaModels\DataAccess\ItemPersister->saveItem(Object(MetaModels\Item))
#4 composer\vendor\metamodels\core\src\MetaModels\Item.php(324): MetaModels\MetaModel->saveItem(Object(MetaModels\Item))
#5 composer\vendor\metamodels\core\src\MetaModels\DcGeneral\Data\Driver.php(582): MetaModels\Item->save()
#6 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask.php(630): MetaModels\DcGeneral\Data\Driver->save(Object(MetaModels\DcGeneral\Data\Model))
#7 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask.php(725): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask->doPersist()
#8 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ActionHandler\EditHandler.php(76): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\EditMask->execute()
#9 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\View\ActionHandler\AbstractHandler.php(54): ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\ActionHandler\EditHandler->process()
#10 [internal function]: ContaoCommunityAlliance\DcGeneral\View\ActionHandler\AbstractHandler->handleEvent(Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#11 composer\vendor\symfony\event-dispatcher\EventDispatcher.php(184): call_user_func(Array, Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent), 'dc-general.acti...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#12 composer\vendor\symfony\event-dispatcher\EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#13 composer\vendor\contao-community-alliance\dc-general\src\ContaoCommunityAlliance\DcGeneral\Controller\DefaultController.php(152): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('dc-general.acti...', Object(ContaoCommunityAlliance\DcGeneral\Event\ActionEvent))
#14 composer\vendor\metamodels\core\src\MetaModels\BackendIntegration\Module.php(74): ContaoCommunityAlliance\DcGeneral\Controller\DefaultController->handle(Object(ContaoCommunityAlliance\DcGeneral\Action))
#15 system\modules\core\classes\Backend.php(423): MetaModels\BackendIntegration\Module->generate()
#16 system\modules\core\controllers\BackendMain.php(131): Contao\Backend->getBackendModule('metamodel_mm_mi...')
#17 contao\main.php(20): Contao\BackendMain->run()
#18 {main}

@zonky2
Copy link
Contributor Author

zonky2 commented Mar 17, 2017

https://github.com/MetaModels/core/blob/feature/item-persister-and-retriever/src/MetaModels/DataAccess/ItemPersister.php#L215

-                    'UPDATE %1$s %%s=? WHERE id IN (%2$s)',
+                    'UPDATE %1$s %%s WHERE id IN (%2$s)',

@zonky2
Copy link
Contributor Author

zonky2 commented Mar 17, 2017

it´s not possible to work with variants

-$variantIds = [];
+$variantIds = [$itemId];

@zonky2 zonky2 added the bug A bug! A bug! Fast, squish it! label Mar 18, 2017
@zonky2
Copy link
Contributor Author

zonky2 commented Mar 28, 2017

@discordier have you a new strategy for vatiants?

note: #871

@discordier
Copy link
Member

Not yet, however we should implement it in here.

@discordier
Copy link
Member

please follow ups to #1112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug! A bug! Fast, squish it! enhancement This issue is about an enhancement (aka new feature)
Projects
None yet
Development

No branches or pull requests

2 participants