We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Connect Phalcon PHP to OrientDB

Hi Everyone,

I've searched for this a bit and couldn't find any obvious response, but how can I connect a Phalcon Application to an OrientDB database?

I'm guessing there is no built in way to do this, so thinking of using the official plug in (https://github.com/orientechnologies/PhpOrient), but don't know how I should actually go about this. Do I need to register a new service in order to do so? or can I just extend an existing Model class?

Thanks in advance for your answers.



16.4k

I wouLd create a service using the driver yo specify

Thanks, how would I go about creating a new service? Checked the docs but it wasn't all that clear.



16.4k
Accepted
answer
edited Mar '15

Let me know if this helps

//example
$di->set('queue', function() use ($config) {
  $client = new PhpOrient( $config->phporient->host,  $config->phporient->port );
  $client->username = 'root';
  $client->password = 'root_pass';
  $client->connect();

  return $client;
});

Totally. Got it now, thank you for your reply