How to use FlowQuery in PHP

Did you know that you can use Flow Query in PHP? Its really easy and helpful when you try develop your own EelHelper. 

<?php
namespace Arsors\Neos\EelHelper;


use Neos\Flow\Annotations as Flow;
use Neos\Eel\ProtectedContextAwareInterface;

 

use Neos\Eel\FlowQuery\FlowQuery; //this is the line that does the trick


class ExampleEelHelper implements ProtectedContextAwareInterface
{
/**
* @param Array $parameter
* @return string
*/
public function example($context) {
$q = new FlowQuery[($context)];
return $q->();
}
/**
* All methods are considered safe
*
* @param string $methodName
* @return boolean
*/
public function allowsCallOfMethod($methodName)
{
return true;
}
}

 

Small hint if you change the context mode from Development to Production in the .htaccess, run a $ FLOW_CONTEXT=Production ./flow flow:cache:flush --force to clear the cache. This should read your Configuration/Production/Settings.yaml correctly.

Last cache from 2021-05-13 at 22:58:38 (Example Eel Helper)