php - has_many Page gridfield draft stage -


i have dataobject product $has_many productpages. myobject()->getcomponents('somepages') returns live pages associated product object.

i need know pages (draft , published) attached object, because want handle un/publishing them gridfield inline editing (as changing other page properties url , title).

i managed draft productpages doing:

$gridfieldlist = versioned::get_by_stage('productpage', 'stage') ->filter(array(   "productid" => $this->id )); 

this returns datalist of product pages no knowledge of associated product context, meaning when try click save, nothing happens.

if use $this->getcomponents('productpages') populate gridfield, changes saved correctly on form submission, if try un-publish page, gets "removed" gridfield.

so question basically, approach can take here have object's associated pages populate gridfield whilst still being aware of context (ie, having changes being saved successfully)?

worth noting i'm running ss 3.1.5 on site =/

phew, 3.1.5 pretty outdated, looked in 3.1.12 , found useful.

the problem is, versioned dataextension automatically modifies sql query filter current stage. , page can have different statuses , therefor in different database tables. fortunately versioned can check dataquery parameter, might you:

$this->myrelation()     ->setdataqueryparam('versioned.mode', 'all_versions'); 

see versioned::augmentsql()


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -