Jump to content

setOutputFormatting error even though it is set to off.


Shehbaz
 Share

Recommended Posts

Hi,

I am facing a strange issue which appears randomly on the server. I have this code in one of my module which un publishes on page and publishes the other after swapping their titles and changing names:

 
                                  $draft->setOutputFormatting(false);
                                   $draft->publish_from='';
                                    $draft->save();

                                    $parent = $draft->parent;
                                    $parent->setOutputFormatting(false);

                                    $name = $parent->name;
                                     $title = $parent->title;

                                     $parent->title =$parent->title. '(DRAFT)-' . ' unpublished at: '.date("Y-m-d H:i:s");
                                     $parent->name = $draft->id."_".$parent->name. "-" . uniqid();
                                     $parent->addStatus(Page::statusUnpublished);
                                     $parent->save();// The issue appears on this line
 
I get issue randomly on last line:
 
Can't save page 3619: /xxxxx/repeaters/for-field-199/for-page-3617/1401436320-9546-1/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved.  [image]

Now this is not the actual page (parent), it is a repeater field inside that page. 
 
 
Stacktrace: #0 [internal function]: Pages->___save(Object(RepeaterPage), Array) #1
call_user_func_array(Array, Array) #2
Wire->runHooks('save', Array) #3
xxxxx/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module(961): Wire->__call('save', Array) #4 xxxxx/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module(961): Pages->save(Object(RepeaterPage), Array) #5
[internal function]: FieldtypeRepeater->___savePageField(Object(Page), Object(Field)) #6
xxxx/wire/core/Wire.php(271): call_user_func_array(Array, Array) #7
xxxx/wire/core/Wire.php(229): Wire->runHooks('savePageField', Array) #8
xxxx/wire/core/Pages.php(576): Wire->__call('savePageField', Array) #9
xxxx/www/wire/core/Pages.php(576): FieldtypeRepeater->savePageField(Object(Page), Object(Field)) #10 
[internal function]: Pages->___save(Object(Page)) #11
xxxx/wire/core/Wire.php(271): call_user_func_array(Array, Array) #12
xxxx/wire/core/Wire.php(229): Wire->runHooks('save', Array) #13
xxxx/wire/core/Page.php(1005): Wire->__call('save', Array) #14
xxxx/wire/core/Page.php(1005): Pages->save(Object(Page)) #15
xxxx/site/modules/SchedulePages.module(222): Page->save() #16
xxxx/wire/core/Wire.php(293): SchedulePages->RunSchedulePages(Object(HookEvent)) #17
xxxx/wire/core/Wire.php(229): Wire->runHooks('everyMinute', Array) #18
xxxx/wire/modules/LazyCron.module(164): Wire->__call('everyMinute', Array) #19
xxxx/wire/modules/LazyCron.module(164): LazyCron->everyMinute(69) #20
xxxx/wire/core/Wire.php(293): LazyCron->afterPageView(Object(HookEvent)) #21
xxxx/wire/core/Wire.php(229): Wire->runHooks('finished', Array) #22
xxxx/index.php(193): Wire->__call('finished', Array)
Any help is appreciated. Thanks
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...