pix-digital / pixSortableBehaviorBundle

Offers a sortable feature for your Symfony2 admin listing
MIT License
46 stars 78 forks source link

Error: Using $this when not in object context (ObjectPositionExtension.php on line 39) #19

Closed rcknr closed 7 years ago

rcknr commented 9 years ago

I get this error when using the default template. PHP 5.3, Symfony 2.6.5.

Hakadel commented 9 years ago

I have the same error, any idea ? :up:

nicolasricci commented 9 years ago

any particular user case where you have the issue. I cannot manage to reproduce

nicolasricci commented 9 years ago

OK I have just noticed the __construct() method is not declared as public ... it is probably coming from there. I will submit a patch now

nicolasricci commented 9 years ago

@Hakadel any better now?

Hakadel commented 9 years ago

@nicolasricci No same error after update... :(

nicolasricci commented 9 years ago

hmmm ok are you using php 5.3 as well? Are you using it a standalone module or within SonataAdmin?

Hakadel commented 9 years ago

I'm using PHP 5.3.10-1ubuntu3.18, with SonataAdmin

nicolasricci commented 9 years ago

ok this is a limitation of php 5.3 indeed. @vvh-empora can you clarify why you require a twig function to get the object position? https://github.com/pix-digital/pixSortableBehaviorBundle/blob/cc7d50e9912b728f98e65d329dd80bc6e405ec71/Resources/views/Default/_sort.html.twig

@Hakadel in the meantime you can override the _sort.html.twig file and use the version from the v0.1 tag (https://github.com/pix-digital/pixSortableBehaviorBundle/blob/v0.1/Resources/views/Default/_sort.html.twig)

nicolasricci commented 9 years ago

@vvh-empora ok sorry I realised it was to get the correct method according to the position_field configuration. I will try to find another way to achieve this so it can remain compatible with php 5.3

Hakadel commented 9 years ago

@nicolasricci Even with the old _sort.html.twig it's not working... Because error is in ObjectPositionExtension.php

nicolasricci commented 9 years ago

the extension is only called by the sortableObjectPosition twig function so if you used the _sort.html.twig file I was referring to you should not have any problem. Alternatively you can use the v0.1 tag which works fine

OskarStark commented 9 years ago

any news on this error?

@Hakadel is it working n the meantime?