Skip to content

Instantly share code, notes, and snippets.

@albe
Created March 31, 2020 17:58
Show Gist options
  • Save albe/4aa3291cadb648d843a4bf4c05b5ae26 to your computer and use it in GitHub Desktop.
Save albe/4aa3291cadb648d843a4bf4c05b5ae26 to your computer and use it in GitHub Desktop.
<?php
namespace Vendor\Site\DataSource;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Neos\Domain\Service\UserService;
use Neos\Neos\Service\DataSource\AbstractDataSource;
use Neos\ContentRepository\Domain\Model\NodeInterface;
class MyDataSource extends AbstractDataSource
{
/**
* @var string
*/
static protected $identifier = 'vendor-site-mydata';
/**
* @Flow\Inject
* @var \Neos\Flow\Http\Client\Browser
*/
protected $browser;
/**
* @param NodeInterface $node The node that is currently edited (optional)
* @param array $arguments Additional arguments (key / value)
* @return array
*/
public function getData(NodeInterface $node = null, array $arguments)
{
$response = $this->browser->request('https://your-symfony-service');
return json_decode($response->getBody()->getContents(), true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment