kinglozzer

There’s at least one extra database query there, but that shouldn’t cause that much delay 😕

nils

Shouldn't all image manipulations be cached? When I add a function that returns return $this->Image()->Fill(600, 400)->getAbsoluteURL(); to my query it takes a lot longer to execute, even if the same URL is returned.

Nathan

I haven’t, I’m sorry. Currently my solution is to pass an argument I’m calling Search and filter accordingly. E.g.

  1. if (isset($args['Search'])) {
  2. $list = $list->filterAny([
  3. 'Title:PartialMatch' => $args['Search'],
  4. 'Content:PartialMatch' => $args['Search'],
  5. ]);
  6. }
unclecheese

@Nathan It supports OR matching for the value, but not the field. Adding disjunctive clauses quickly sends you down a rabbit hole, because now you introduce things like nested conditions, and it gets really messy. For the first pass at this, it seemed sufficient to just do AND. I’d be curious how other graphql APIs deal with the syntax of this. Have you seen any examples?

Nemanja Karadzic

if you try to utilize yaml file over php implementation, yoi're going to have bad time, sooner or later. Especialy if fluent and versioned come into the picture

Nathan

Hey guys, I’m dipping my feet into the waters of GraphQL on SilverStripe 4. I’ve started to utilise Filters for the first time, which I have working on my DataObject query. However, I was wondering if there’s a way to perform the equivalent of a FilterAny. My current implementation is essentially a series of AND statements (Title = 'Test' AND Contents = 'Test'). What I’m trying to achieve is more of an OR (Title = 'Test' OR Contents = 'Test'). I’ve managed to achieve this explicitly via the args themselves, however I’d prefer to utilise Filters if that’s the best practice. Any ideas?

Nemanja Karadzic
  1. class EnsureBloodyDraftExtension extends Extension
  2. {
  3. public function augmentMutation(&$obj, &$args, $context, $info){
  4. {
  5. //check if object is Versioned
  6. if ($obj->hasExtension(Versioned::class))
  7. {
  8. //yup, it is, change stage to draft
  9. Versioned::set_stage(Versioned::DRAFT);
  10. }
  11. }
  12. }