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

During creation of Media still categoryselect prepersist problem #464

Closed
espaan opened this issue Jan 14, 2014 · 9 comments
Closed

During creation of Media still categoryselect prepersist problem #464

espaan opened this issue Jan 14, 2014 · 9 comments
Assignees
Labels
Milestone

Comments

@espaan
Copy link
Contributor

espaan commented Jan 14, 2014

Hi,

During creation of Media in SimpleMedia2 I still get some errors.

This is not when I create a medium directly, but only when I create a medium via a collection. Then this error pops up.

commenting out the category selection int eh medium/edit.tpl template the works and removes this error. See also #321

You said there
It looks like the category selector tries to persist things before the form handler has prepared relations.
What can I do/check to make this work then ?

Fout in Camper huren bij CamperToday
Foutmelding! Kon de 'simplemedia' module niet laden bij 'edit'.
Error! Field value must not be empty (title).
Exception Trace
#0 Er heeft zich een uitzondering voorgedaan in /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Entity/Base/Medium.php, regel 1004.
#1 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Entity/Medium.php(57): SimpleMedia_Entity_Base_Medium->performPrePersistCallback()
#2 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1540): SimpleMedia_Entity_Medium->prePersistCallback()
#3 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/UnitOfWork.php(621): Doctrine\ORM\Mapping\ClassMetadataInfo->invokeLifecycleCallbacks('prePersist', Object(SimpleMedia_Entity_Medium))
#4 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/UnitOfWork.php(601): Doctrine\ORM\UnitOfWork->persistNew(Object(Doctrine\ORM\Mapping\ClassMetadata), Object(SimpleMedia_Entity_Medium))
#5 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/UnitOfWork.php(513): Doctrine\ORM\UnitOfWork->computeAssociationChanges(Array, Object(Doctrine\ORM\PersistentCollection))
#6 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/UnitOfWork.php(555): Doctrine\ORM\UnitOfWork->computeChangeSet(Object(Doctrine\ORM\Mapping\ClassMetadata), Object(SimpleMedia_Entity_Collection))
#7 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/UnitOfWork.php(261): Doctrine\ORM\UnitOfWork->computeChangeSets()
#8 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/EntityManager.php(334): Doctrine\ORM\UnitOfWork->commit()
#9 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/Plugin/CategorySelector.php(263): Doctrine\ORM\EntityManager->flush()
#10 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1387): Zikula_Form_Plugin_CategorySelector->saveValue(Object(Zikula_Form_View), Array)
#11 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1384): Zikula_Form_View->getValues_rec(Array, Array)
#12 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1384): Zikula_Form_View->getValues_rec(Array, Array)
#13 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1364): Zikula_Form_View->getValues_rec(Array, Array)
#14 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Form/Handler/Admin/Base/Edit.php(687): Zikula_Form_View->getValues()
#15 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Form/Handler/Admin/Base/Edit.php(514): SimpleMedia_Form_Handler_Admin_Base_Edit->fetchInputData(Object(Zikula_Form_View), Array)
#16 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Form/Handler/Admin/Medium/Base/Edit.php(162): SimpleMedia_Form_Handler_Admin_Base_Edit->handleCommand(Object(Zikula_Form_View), Array)
#17 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(889): SimpleMedia_Form_Handler_Admin_Medium_Base_Edit->handleCommand(Object(Zikula_Form_View), Array)
#18 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/Plugin/Button.php(153): Zikula_Form_View->raiseEvent('handleCommand', Array)
#19 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1292): Zikula_Form_Plugin_Button->decodePostBackEvent(Object(Zikula_Form_View))
#20 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1291): Zikula_Form_View->decodePostBackEvent_rec(Array)
#21 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(1278): Zikula_Form_View->decodePostBackEvent_rec(Array)
#22 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/Zikula/Form/View.php(274): Zikula_Form_View->decodePostBackEvent()
#23 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Controller/Base/Admin.php(311): Zikula_Form_View->execute('admin/medium/ed...', Object(SimpleMedia_Form_Handler_Admin_Medium_Edit))
#24 [internal function]: SimpleMedia_Controller_Base_Admin->edit(Array)
#25 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/util/ModUtil.php(1091): call_user_func(Array, Array)
#26 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/util/ModUtil.php(1173): ModUtil::exec('SimpleMedia', 'admin', 'edit', Array, false, NULL)
#27 /Volumes/DATA_ES/MAMP_htdocs/ct136/index.php(78): ModUtil::func('SimpleMedia', 'admin', 'edit', Array)
#28 {main}
@ghost ghost assigned Guite Jan 15, 2014
@Guite
Copy link
Owner

Guite commented Jan 15, 2014

@espaan
Copy link
Contributor Author

espaan commented Jan 15, 2014

For test, or would that be a general thing ?

It does work indeed, this now makes medium entity creation directly and from a collection work 👍
Thanks !

That would be a solution in general for 1.3.6 then for these kind of problems with category selector.

@Guite
Copy link
Owner

Guite commented Jan 15, 2014

I think I will do the following:

  1. PR for 1.3.7
  2. PR for 1.3.6patch (Ralf's repo)
  3. Remark in the manual's troubleshooting chapter

@Guite
Copy link
Owner

Guite commented Jan 15, 2014

A possible problem/drawback is that this could prevent saving categories in older non-Doctrine modules.
But at the end it is still a bug.

@espaan
Copy link
Contributor Author

espaan commented Jan 15, 2014

Can you distuinguish between those in the CategorySelector itself ? Probably not. There are of course still several non-Doctrine modules out there, certainly for Core 136. That do use category selection.

@Guite
Copy link
Owner

Guite commented Jan 15, 2014

We can distinguish as the category selector knows different modes. This issue affects only the doctrine2 mode 😄

@espaan
Copy link
Contributor Author

espaan commented Jan 15, 2014

I see that the category selection in News and Content work fine still after this update. So those are not affected at all. That makes this change for the "old" DBUtil modules easier.

@Guite
Copy link
Owner

Guite commented Jan 15, 2014

@Guite Guite closed this as completed Jan 15, 2014
@Guite
Copy link
Owner

Guite commented Jan 15, 2014

ghost pushed a commit to zikula/core that referenced this issue Jan 16, 2014
This PR was merged into zikula:1.3 branch.

Discussion
----------

Avoid flush by category selector

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | Guite/MostGenerator#464
| Refs tickets  | 
| License       | MIT
| Doc PR        | 

Commits
-------

b52f4e3 Avoid flush by category selector Guite
This issue was closed.
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

2 participants