Coder Social home page Coder Social logo

Comments (7)

colymba avatar colymba commented on July 30, 2024

True, I haven't used the CMS for a while. When developing an app this get's managed by Ember.

But I can see that DataObject with Versioned enabled could be an issue.

First thing that comes to mind would be to extend RESTfulAPI_DefaultQueryHandler and override handleQuery() with a few hooks. Maybe something like this:

public function handleQuery(SS_HTTPRequest $request)
{
    $result = parent::handleQuery($request);

    //Check if result....
    //If yes get the classname from the result (DataObject or DataList)
    //Check if the class has the extension Versioned enabled
    //if yes call doPublish() on each DataObject

    return $result;
}

The basic idea is here, and there should not be much more to change. You could also pass a query parameter with your request like ?versioned=publish or ?versioned=unpublish so you know if you need to publish or unpublish...

ps: just curious, have you been using Ember with SS too?

from silverstripe-restfulapi.

DarioSoller avatar DarioSoller commented on July 30, 2024

thanks for your quick answer! I have tried couple of things, but couldn't solve the issue yet. I keep you updated... It just never sets the attributes wasPublished = 1 and PublisherID = 2 in the SiteTree_versions table of the SS database.

My goal is to make an ember client app for parts of the database of an already existing silverstripe CMS. Therefore I am currently working on a test SS project, to not mess up the whole thing. I liked the approach of both, ember and silverstripe, so I came up with the idea of trying to couple them somehow. Little research brought me to your git...

Anyway, cool project! So I will love to share my experiences along the way and keep you updated

from silverstripe-restfulapi.

colymba avatar colymba commented on July 30, 2024

I'll see what I can come up with about the Versioned object issue and let you know if I find a solution.

In the meanwhile, yes please do keep me posted how you get on with Ember and this API, eager to get feedback and use cases comments....

from silverstripe-restfulapi.

richwestcoast avatar richwestcoast commented on July 30, 2024

Any progress with this? :)

from silverstripe-restfulapi.

colymba avatar colymba commented on July 30, 2024

Am not around much lately so it doesn't get much attention unfortunately... Happy for any one to pick this up :)

Like posted above, all this should need is extend the QueryHandler handleQuery to check if the requested class is Versioned and use a URL query parameter to toggle the publish/unpublish...

Although I don't think this would make it in the master but maybe in a recipe like note in the doc...

from silverstripe-restfulapi.

DarioSoller avatar DarioSoller commented on July 30, 2024

Same with me, unfortunately haven't found the time to try it out yet!

from silverstripe-restfulapi.

colymba avatar colymba commented on July 30, 2024

Tracking those here #27

from silverstripe-restfulapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.