Development

#886 ([PATCH] many-to-many relations and escaping don't work)

You must first sign up to be able to contribute.

Ticket #886 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

[PATCH] many-to-many relations and escaping don't work

Reported by: andreas Assigned to:
Priority: minor Milestone: 1.0.0
Component: Version: 0.7.X
Keywords: many-to-many Cc:
Qualification:

Description

Reproduce by using the admin-generator and admin_*_list, for example admin_double_list and turning on escaping in view.yml.

escaping:
	strategy: both
	method: ESC_ENTITIES

Call Stack:
Warning: constant() [<a href='function.constant'>function.constant</a>]: Couldn't find constant sfOutputEscaperObjectDecoratorPeer::TABLE_NAME in /usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php on line 39
Call Stack
#	Function	Location
1	{main}()	/home/andi/workspace/radius/rad2/web/test1_dev.php:0
2	sfFrontWebController->dispatch()	/home/andi/workspace/radius/rad2/web/test1_dev.php:10
3	sfController->forward()	/usr/share/php/symfony/controller/sfFrontWebController.class.php:48
4	sfFilterChain->execute()	/usr/share/php/symfony/controller/sfController.class.php:313
5	sfWebDebugFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
6	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfWebDebugFilter.class.php:37
7	sfBasicSecurityFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
8	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfBasicSecurityFilter.class.php:67
9	sfCommonFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
10	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfCommonFilter.class.php:30
11	sfFlashFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
12	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfFlashFilter.class.php:50
13	sfExecutionFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
14	sfPHPView->render()	/usr/share/php/symfony/filter/sfExecutionFilter.class.php:156
15	sfPHPView->renderFile()	/usr/share/php/symfony/view/sfPHPView.class.php:317
16	require('/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php')	/usr/share/php/symfony/view/sfPHPView.class.php:147
17	object_admin_check_list()	/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php:76
18	sfPropelManyToMany::getAllObjects()	/usr/share/php/symfony/helper/ObjectAdminHelper.php:152
19	sfPropelManyToMany::getRelatedClass()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:75
20	sfPropelManyToMany::getRelatedColumn()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:51
21	constant ()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:39

Warning: constant() [<a href='function.constant'>function.constant</a>]: Couldn't find constant sfOutputEscaperObjectDecoratorPeer::TABLE_NAME in /usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php on line 39
Call Stack
#	Function	Location
1	{main}()	/home/andi/workspace/radius/rad2/web/test1_dev.php:0
2	sfFrontWebController->dispatch()	/home/andi/workspace/radius/rad2/web/test1_dev.php:10
3	sfController->forward()	/usr/share/php/symfony/controller/sfFrontWebController.class.php:48
4	sfFilterChain->execute()	/usr/share/php/symfony/controller/sfController.class.php:313
5	sfWebDebugFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
6	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfWebDebugFilter.class.php:37
7	sfBasicSecurityFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
8	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfBasicSecurityFilter.class.php:67
9	sfCommonFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
10	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfCommonFilter.class.php:30
11	sfFlashFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
12	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfFlashFilter.class.php:50
13	sfExecutionFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
14	sfPHPView->render()	/usr/share/php/symfony/filter/sfExecutionFilter.class.php:156
15	sfPHPView->renderFile()	/usr/share/php/symfony/view/sfPHPView.class.php:317
16	require('/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php')	/usr/share/php/symfony/view/sfPHPView.class.php:147
17	object_admin_check_list()	/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php:76
18	sfPropelManyToMany::getRelatedObjects()	/usr/share/php/symfony/helper/ObjectAdminHelper.php:153
19	sfPropelManyToMany::getRelatedClass()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:94
20	sfPropelManyToMany::getRelatedColumn()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:51
21	constant ()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:39

Warning: call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'Area::getAreaNASsJoinArea' was given in /usr/share/php/symfony/view/escaper/sfOutputEscaperObjectDecorator.class.php on line 63
Call Stack
#	Function	Location
1	{main}()	/home/andi/workspace/radius/rad2/web/test1_dev.php:0
2	sfFrontWebController->dispatch()	/home/andi/workspace/radius/rad2/web/test1_dev.php:10
3	sfController->forward()	/usr/share/php/symfony/controller/sfFrontWebController.class.php:48
4	sfFilterChain->execute()	/usr/share/php/symfony/controller/sfController.class.php:313
5	sfWebDebugFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
6	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfWebDebugFilter.class.php:37
7	sfBasicSecurityFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
8	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfBasicSecurityFilter.class.php:67
9	sfCommonFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
10	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfCommonFilter.class.php:30
11	sfFlashFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
12	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfFlashFilter.class.php:50
13	sfExecutionFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
14	sfPHPView->render()	/usr/share/php/symfony/filter/sfExecutionFilter.class.php:156
15	sfPHPView->renderFile()	/usr/share/php/symfony/view/sfPHPView.class.php:317
16	require('/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php')	/usr/share/php/symfony/view/sfPHPView.class.php:147
17	object_admin_check_list()	/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php:76
18	sfPropelManyToMany::getRelatedObjects()	/usr/share/php/symfony/helper/ObjectAdminHelper.php:153
19	sfOutputEscaperObjectDecorator->getAreaNASsJoinArea()	/usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php:99
20	sfOutputEscaperObjectDecorator->__call()	/usr/share/php/symfony/view/escaper/sfOutputEscaperObjectDecorator.class.php:0
21	call_user_func_array ()	/usr/share/php/symfony/view/escaper/sfOutputEscaperObjectDecorator.class.php:63

Warning: Invalid argument supplied for foreach() in /usr/share/php/symfony/addon/propel/sfPropelManyToMany.class.php on line 100
Call Stack
#	Function	Location
1	{main}()	/home/andi/workspace/radius/rad2/web/test1_dev.php:0
2	sfFrontWebController->dispatch()	/home/andi/workspace/radius/rad2/web/test1_dev.php:10
3	sfController->forward()	/usr/share/php/symfony/controller/sfFrontWebController.class.php:48
4	sfFilterChain->execute()	/usr/share/php/symfony/controller/sfController.class.php:313
5	sfWebDebugFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
6	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfWebDebugFilter.class.php:37
7	sfBasicSecurityFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
8	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfBasicSecurityFilter.class.php:67
9	sfCommonFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
10	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfCommonFilter.class.php:30
11	sfFlashFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
12	sfFilterChain->execute()	/usr/share/php/symfony/filter/sfFlashFilter.class.php:50
13	sfExecutionFilter->execute()	/usr/share/php/symfony/filter/sfFilterChain.class.php:76
14	sfPHPView->render()	/usr/share/php/symfony/filter/sfExecutionFilter.class.php:156
15	sfPHPView->renderFile()	/usr/share/php/symfony/view/sfPHPView.class.php:317
16	require('/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php')	/usr/share/php/symfony/view/sfPHPView.class.php:147
17	object_admin_check_list()	/home/andi/workspace/radius/rad2/cache/test1/dev/modules/autoAreaadmin/templates/editSuccess.php:76
18	sfPropelManyToMany::getRelatedObjects()	/usr/share/php/symfony/helper/ObjectAdminHelper.php:153

Change History

09/08/06 09:20:45 changed by fabien

  • milestone set to 1.0.0.

09/15/06 11:11:26 changed by andreas

  • summary changed from many-to-many relations and escaping don't work to [PATCH] many-to-many relations and escaping don't work.

I don't know how to fix this one "the right way" cause I'm just getting started with symfony but the following patch does the trick. The problem is that the Objectadminhelper gets an sfOutputEscaperObjectDecorator Object instead of Propel BaseObject, which it passes on the propel many-to-many.

Diff against rev. 1914:

53a54,58
>   if (get_class($object) ==  'sfOutputEscaperObjectDecorator') {
>     $rawObject = $object->getRawValue();
>   } else {
>     $rawObject = $object;
>   }
70,71c75,76
<   $objects_associated = sfPropelManyToMany::getRelatedObjects($object, $through_class);
<   $all_objects = sfPropelManyToMany::getAllObjects($object, $through_class);
---
>   $objects_associated = sfPropelManyToMany::getRelatedObjects($rawObject, $through_class);
>   $all_objects = sfPropelManyToMany::getAllObjects($rawObject, $through_class);
120a126,131
>
>   if (get_class($object) ==  'sfOutputEscaperObjectDecorator') {
>     $rawObject = $object->getRawValue();
>   } else {
>     $rawObject = $object;
>   }
130,131c141,142
<   $objects = sfPropelManyToMany::getAllObjects($object, $through_class);
<   $objects_associated = sfPropelManyToMany::getRelatedObjects($object, $through_class);
---
>   $objects = sfPropelManyToMany::getAllObjects($rawObject, $through_class);
>   $objects_associated = sfPropelManyToMany::getRelatedObjects($rawObject, $through_class);
144a156,161
>
>   if (get_class($object) ==  'sfOutputEscaperObjectDecorator') {
>       $rawObject = $object->getRawValue();
>     } else {
>       $rawObject = $object;
>     }
152,153c169,170
<   $objects = sfPropelManyToMany::getAllObjects($object, $through_class);
<   $objects_associated = sfPropelManyToMany::getRelatedObjects($object, $through_class);
---
>   $objects = sfPropelManyToMany::getAllObjects($rawObject, $through_class);
>   $objects_associated = sfPropelManyToMany::getRelatedObjects($rawObject, $through_class);

11/25/06 11:15:06 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [2813]) fixed many-to-many relations and escaping don't work (closes #886)