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

Exception during creation of Media in SM2 #321

Closed
espaan opened this issue Mar 14, 2013 · 13 comments
Closed

Exception during creation of Media in SM2 #321

espaan opened this issue Mar 14, 2013 · 13 comments
Assignees
Milestone

Comments

@espaan
Copy link
Contributor

espaan commented Mar 14, 2013

Hi,

MOST 060 Final, zk135 target (so not 136), SimpleMedia 2, Zikula135Build20

I get an exception that I cannot understand during creation of a media entity below an already created collection, so calling
http://localhost/zk135b20/index.php?module=simplemedia&type=admin&func=edit&ot=medium&collection=1&returnTo=adminDisplayCollection

A new entity was found through the relationship 'SimpleMedia_Entity_Collection#media' that was not configured to cascade persist operations for entity: . Explicitly persist the new entity or configure cascading persist operations on the relationship. If you cannot find out which entity causes the problem implement 'SimpleMedia_Entity_Medium#__toString()' to get a clue.

Full trace:

#0 Exception thrown in C:\Apps\xampp\htdocs\zk135b20\plugins\Doctrine\lib\vendor\Doctrine\ORM\UnitOfWork.php, line 594.
#1 C:\Apps\xampp\htdocs\zk135b20\plugins\Doctrine\lib\vendor\Doctrine\ORM\UnitOfWork.php(555): Doctrine\ORM\UnitOfWork->computeChangeSet(Object(Doctrine\ORM\Mapping\ClassMetadata), Object(SimpleMedia_Entity_Collection))
#2 C:\Apps\xampp\htdocs\zk135b20\plugins\Doctrine\lib\vendor\Doctrine\ORM\UnitOfWork.php(261): Doctrine\ORM\UnitOfWork->computeChangeSets()
#3 C:\Apps\xampp\htdocs\zk135b20\plugins\Doctrine\lib\vendor\Doctrine\ORM\EntityManager.php(334): Doctrine\ORM\UnitOfWork->commit()
#4 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\Plugin\CategorySelector.php(263): Doctrine\ORM\EntityManager->flush()
#5 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1387): Zikula_Form_Plugin_CategorySelector->saveValue(Object(Zikula_Form_View), Array)
#6 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1384): Zikula_Form_View->getValues_rec(Array, Array)
#7 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1384): Zikula_Form_View->getValues_rec(Array, Array)
#8 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1364): Zikula_Form_View->getValues_rec(Array, Array)
#9 C:\Apps\xampp\htdocs\zk135b20\modules\SimpleMedia\lib\SimpleMedia\Form\Handler\Admin\Base\Edit.php(624): Zikula_Form_View->getValues()
#10 C:\Apps\xampp\htdocs\zk135b20\modules\SimpleMedia\lib\SimpleMedia\Form\Handler\Admin\Base\Edit.php(471): SimpleMedia_Form_Handler_Admin_Base_Edit->fetchInputData(Object(Zikula_Form_View), Array)
#11 C:\Apps\xampp\htdocs\zk135b20\modules\SimpleMedia\lib\SimpleMedia\Form\Handler\Admin\Medium\Base\Edit.php(157): SimpleMedia_Form_Handler_Admin_Base_Edit->handleCommand(Object(Zikula_Form_View), Array)
#12 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(889): SimpleMedia_Form_Handler_Admin_Medium_Base_Edit->handleCommand(Object(Zikula_Form_View), Array)
#13 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\Plugin\Button.php(153): Zikula_Form_View->raiseEvent('handleCommand', Array)
#14 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1292): Zikula_Form_Plugin_Button->decodePostBackEvent(Object(Zikula_Form_View))
#15 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1291): Zikula_Form_View->decodePostBackEvent_rec(Array)
#16 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(1278): Zikula_Form_View->decodePostBackEvent_rec(Array)
#17 C:\Apps\xampp\htdocs\zk135b20\lib\Zikula\Form\View.php(274): Zikula_Form_View->decodePostBackEvent()
#18 C:\Apps\xampp\htdocs\zk135b20\modules\SimpleMedia\lib\SimpleMedia\Controller\Base\Admin.php(309): Zikula_Form_View->execute('admin/medium/ed...', Object(SimpleMedia_Form_Handler_Admin_Medium_Edit))
#19 [internal function]: SimpleMedia_Controller_Base_Admin->edit(Array)
#20 C:\Apps\xampp\htdocs\zk135b20\lib\util\ModUtil.php(1091): call_user_func(Array, Array)
#21 C:\Apps\xampp\htdocs\zk135b20\lib\util\ModUtil.php(1173): ModUtil::exec('SimpleMedia', 'admin', 'edit', Array, false, NULL)
#22 C:\Apps\xampp\htdocs\zk135b20\index.php(78): ModUtil::func('SimpleMedia', 'admin', 'edit', Array)
#23 {main}
@Guite
Copy link
Owner

Guite commented Mar 14, 2013

It looks like the category selector tries to persist things before the form handler has prepared relations.
Can you please try to open the edit template and comment out the include statement for the category selection? Curious if it works then.

@espaan
Copy link
Contributor Author

espaan commented Mar 14, 2013

ok will try later on.

It looks like the category selector tries to persist things before the form

handler has prepared relations.
Can you please try to open the edit template and comment out the include
statement for the category selection? Curious if it works then.

@espaan
Copy link
Contributor Author

espaan commented Jan 12, 2014

Hi, I finally have tested again. Got the current webgen code into the module and commented out the category selection in the medium edit template.
I have added persist cascade as suggested in #409, that solves some part already.

I have commented out category selection and then the Title validation message like in #410 is gone. However still a new message is there. Media is created, but when being redirected to index.php?module=simplemedia&type=admin&func=view&ot=medium

the following error is shown, any idea ? The class nullSimpleMedia_Entity_Collection does not exist, what is that null doing there ?

I did trace back as far as I could, but through Doctrine is a bit hard.

Fout in Camper huren bij CamperToday
Foutmelding! Kon de 'simplemedia' module niet laden bij 'view'.
Class nullSimpleMedia_Entity_Collection does not exist
Exception Trace
#0 Er heeft zich een uitzondering voorgedaan in /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Proxy/ProxyFactory.php, regel 194.
#1 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Proxy/ProxyFactory.php(131): Doctrine\ORM\Proxy\ProxyFactory->_generateMethods(Object(Doctrine\ORM\Mapping\ClassMetadata))
#2 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Proxy/ProxyFactory.php(83): Doctrine\ORM\Proxy\ProxyFactory->_generateProxyClass(Object(Doctrine\ORM\Mapping\ClassMetadata), 'SimpleMedia_Ent...', 'ztemp/doctrinem...', '<?php??namespac...')
#3 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/UnitOfWork.php(2062): Doctrine\ORM\Proxy\ProxyFactory->getProxy('SimpleMedia_Ent...', Array)
#4 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php(208): Doctrine\ORM\UnitOfWork->createEntity('SimpleMedia_Ent...', Array, Array)
#5 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php(426): Doctrine\ORM\Internal\Hydration\ObjectHydrator->_getEntity(Array, 'tbl')
#6 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php(133): Doctrine\ORM\Internal\Hydration\ObjectHydrator->_hydrateRow(Array, Array, Array)
#7 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(99): Doctrine\ORM\Internal\Hydration\ObjectHydrator->_hydrateAll()
#8 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/AbstractQuery.php(615): Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll(Object(Doctrine\DBAL\Driver\PDOStatement), Object(Doctrine\ORM\Query\ResultSetMapping), Array)
#9 /Volumes/DATA_ES/MAMP_htdocs/ct136/plugins/Doctrine/lib/vendor/Doctrine/ORM/AbstractQuery.php(413): Doctrine\ORM\AbstractQuery->execute(Array, 1)
#10 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Entity/Repository/Base/Medium.php(701): Doctrine\ORM\AbstractQuery->getResult()
#11 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Entity/Repository/Base/Medium.php(519): SimpleMedia_Entity_Repository_Base_Medium->retrieveCollectionResult(Object(Doctrine\ORM\Query), 'zipcode asc', true)
#12 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Api/Base/Selection.php(138): SimpleMedia_Entity_Repository_Base_Medium->selectWherePaginated('', 'zipcode asc', 1, 20, true, false)
#13 [internal function]: SimpleMedia_Api_Base_Selection->getEntitiesPaginated(Array)
#14 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/util/ModUtil.php(1091): call_user_func(Array, Array)
#15 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/util/ModUtil.php(1199): ModUtil::exec('SimpleMedia', 'selection', 'getEntitiesPagi...', Array, true, NULL)
#16 /Volumes/DATA_ES/MAMP_htdocs/ct136/modules/SimpleMedia/lib/SimpleMedia/Controller/Base/Admin.php(171): ModUtil::apiFunc('SimpleMedia', 'selection', 'getEntitiesPagi...', Array)
#17 [internal function]: SimpleMedia_Controller_Base_Admin->view(Array)
#18 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/util/ModUtil.php(1091): call_user_func(Array, Array)
#19 /Volumes/DATA_ES/MAMP_htdocs/ct136/lib/util/ModUtil.php(1173): ModUtil::exec('SimpleMedia', 'admin', 'view', Array, false, NULL)
#20 /Volumes/DATA_ES/MAMP_htdocs/ct136/index.php(78): ModUtil::func('SimpleMedia', 'admin', 'view', Array)
#21 {main}

@espaan
Copy link
Contributor Author

espaan commented Jan 13, 2014

Or is it Core related, I'm using the current 1.3.6 version. Where the class is just not found, where it should be found. ?

@Guite
Copy link
Owner

Guite commented Jan 13, 2014

I doubt this is a core problem...

@espaan
Copy link
Contributor Author

espaan commented Jan 13, 2014

I don't really know where to look, what would you suggest to look into in debugging ?

@drummer3333
Copy link
Contributor

please, do a text search for nullSimpleMedia_Entity_Collection in your module.

@espaan
Copy link
Contributor Author

espaan commented Jan 13, 2014

Ah thanks, didnt think of that
in modules\SimpleMedia\lib\SimpleMedia\Entity\Base\Collection.php
around line 597 (https://github.com/zikula-ev/SimpleMedia/blob/master/src/modules/SimpleMedia/lib/SimpleMedia/Entity/Base/Collection.php#L597) it says

    /**
     * Get parent.
     *
     * @return nullSimpleMedia_Entity_Collection
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Set parent.
     *
     * @param nullSimpleMedia_Entity_Collection $parent.
     *
     * @return void
     */
    public function setParent(nullSimpleMedia_Entity_Collection $parent = null)
    {
        $this->parent = $parent;
    }

this will not work. This base class is directly coming from the generator.

Now I see more of those, also
https://github.com/zikula-ev/SimpleMedia/blob/master/src/modules/SimpleMedia/lib/SimpleMedia/Entity/Base/Medium.php#L752

    public function setMetadata(nullSimpleMedia_Entity_MediumMetaData $metadata = null)

But that's it, no other nullSimpleMedia... found in the code

@Guite
Copy link
Owner

Guite commented Jan 13, 2014

The null value thingy is probably fixed in f20aeef

@espaan
Copy link
Contributor Author

espaan commented Jan 13, 2014

I have now removed them manually in the code, so just removed null from the Classnames and then it works. So I can upload media. With categories selection disabled in Medium templates/admin/medium/edit.tpl

I have then of course also tried with categories enabled and now it also works 👍 So it seems that this was just the null in the classname problem.

Pfew, I can now go ahead and get all the stuff from the MOST 0.5 version into the MOST 0.6.1 version. To get a workable SimpleMedia 2 version again. Thanks.

@Guite
Copy link
Owner

Guite commented Jan 13, 2014

Great 😄

@Guite Guite closed this as completed Jan 13, 2014
@espaan
Copy link
Contributor Author

espaan commented Jan 13, 2014

Is f20aeef already in the webgen ? Then I can test if a fresh generated version does what it should.

@Guite
Copy link
Owner

Guite commented Jan 13, 2014

Yes it is.

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

No branches or pull requests

3 participants