Skip to content

Instantly share code, notes, and snippets.

@riscos
Last active December 20, 2015 09:49
Show Gist options
  • Save riscos/6110845 to your computer and use it in GitHub Desktop.
Save riscos/6110845 to your computer and use it in GitHub Desktop.
Repo function to get sibling $category objects but not the $category itself
// This is what I currently have, but of course $category is also found
public function findSiblings($category = NULL) {
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals('hidden', 0),
$query->equals('published', 1),
$query->equals('parent', $category->getParent())
)
);
$query->setOrderings(
array('title' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING)
);
return $query->execute();
}
// I tried this (persistence_object_identifier maybe the wrong columns name in this example - I can't rememeber exactly what it is, but in my real code it's whatever you see in phpmayadmin as the objects unique identifier)
...
$query->matching(
$query->logicalAnd(
$query->equals('hidden', 0),
$query->equals('published', 1),
$query->equals('parent', $category->getParent())
$query->logicalNot(
$query->equals('persistence_object_identifier', $category),
)
)
);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment