Nico
Nico

Reputation: 569

Cakephp 2.x doesnt have an oracle datasource, need some ideas

For a production system that needs a stable underlying system I need to come up with some idea's to get oracle working with cakephp, if not we'll have to move to other frameworks, something I'd like to prevent(multiple software packages already running on cake).

I've read about using the 1.3 datasource and to modify it so it works with 2.x, now this is all not really official, stable and fully tested, features missing and stuff like that.

This is just an idea until an official data source can be made, but what about using the oracle datasource as an interface to use doctrine as a DBAL?

Personally I don't have any experience with doctrine, but I heard good things about it, would it be possible with a minimal amount of effort to use the datasource as a pass-through class and use doctrine in the background?

That way we have a proven underlying DBAL and the datasource only acts as a pass-though class.

After a quick look on their website you can do things like:

$qb = $conn->createQueryBuilder()
->update('users', 'u')
->set('u.password', md5('password'))
->where('u.id = ?');

$qb = $conn->createQueryBuilder()
->delete('users', 'u')
->where('u.id = :user_id');
->setParameter(':user_id', 1);

This looks exactly as the conditions array, don't know about groupby & joins(that's why I'm here)

What do you guys think?, a viable option to have cake oracle support with a proven dbal?

Upvotes: 0

Views: 482

Answers (2)

steinkel
steinkel

Reputation: 1186

CakePHP 3 now have Oracle support via CakePHP 3 Driver for Oracle Database, both Oracle 11g and 12c are compatible, and access to the main features like cursors, methods, sequences is provided. CakePHP pagination is also working out of the box. Check:

Thanks,

Upvotes: 2

floriank
floriank

Reputation: 25698

would it be possible with a minimal amount of effort to use the datasource as a pass-through class and use doctrine in the background?

Yes it is possible but not with minimal effort. You will still have to implement the conversion of the CakePHP query to either the oracle query syntax directly OR to rebuild the query using the doctrine API. I think this might take less time than doing a complete oracle driver without using native oracle syntax but it will still take a lot of time.

I have not checked how much effort it would take to make the 1.3 driver work with 2.0 but if there are already people on it you could try to test it, check if there are unit tests. If there are no unit tests... meh... If there are you might be faster by contributing to this project and help finishing the driver.

So if you're looking for a quick solution I do not think there is any. There are professional CakePHP companies that could help you to build the driver quickly if you have the resources. Let me know if that is an option for you.

Upvotes: 0

Related Questions