Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean integration of CouchDB #524

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions CouchDocument/AuthCodeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@ public function deleteAuthCode(AuthCodeInterface $authCode)
*/
public function deleteExpired()
{
$result = $this
->repository
->createQueryBuilder()
->remove()
->field('expiresAt')->lt(time())
->getQuery(['safe' => true])
->execute()
;

return $result['n'];
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't the existing code work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CouchDB work with JS view to make request, I don't have function to request and check date, I have to find a way to make this view and import this view in CouchDB.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but ODM abstracts all of it away. My questions was: why can't existing code (or something very similar to it) do the same task.

}
}
16 changes: 8 additions & 8 deletions CouchDocument/ClientManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

use Doctrine\ODM\CouchDB\DocumentManager;
use Doctrine\ODM\CouchDB\DocumentRepository;
use FOS\OAuthServerBundle\Model\ClientManager as BaseClientManager;
use FOS\OAuthServerBundle\Model\ClientInterface;
use FOS\OAuthServerBundle\Model\ClientManager as BaseClientManager;

class ClientManager extends BaseClientManager
{
Expand Down Expand Up @@ -55,15 +55,15 @@ public function getClass()
*/
public function findClientBy(array $criteria)
{
$client = $this->repository->findOneBy(["randomId"=>$criteria["randomId"]]);
$client = $this->repository->findOneBy(['randomId' => $criteria['randomId']]);

if ($client != null) {
if ($client->getId() == $criteria["id"]) {
return $client;
}
}
if ($client !== null) {
if ($client->getId() === $criteria['id']) {
return $client;
}
}

return null;
return null;
}

/**
Expand Down
9 changes: 1 addition & 8 deletions CouchDocument/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ public function deleteToken(TokenInterface $token)
*/
public function deleteExpired()
{
$result = $this->dm->createQuery('symfony', 'accesstoken')
->remove()
->field('expiresAt')->lt(time())
->getQuery(['safe' => true])
->execute()
;

return $result['n'];
return null;
}
}
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"friendsofsymfony/oauth2-php": "~1.1",
"symfony/framework-bundle": "~3.0|^4.0",
"symfony/security-bundle": "~3.0|^4.0",
"symfony/dependency-injection": "^2.8|~3.0|^4.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removing this?

"symfony/dependency-injection": "^2.8|~3.0|^4.0",
"alcaeus/mongo-php-adapter": "^1.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is related to Mongo ODM, don't need it.

},
"require-dev": {
"symfony/class-loader": "~3.0|^4.0",
Expand All @@ -34,6 +35,9 @@
"doctrine/mongodb-odm": "~1.0",
"doctrine/doctrine-bundle": "~1.0",
"doctrine/orm": "~2.2",
"doctrine/couchdb": "1.0.x-dev",
"doctrine/couchdb-odm": "dev-master",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH this is the problem I'm seeing here, I'd like for them to do a release before we integrate it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, CouchDB 2.1 was just release so I hope some people can update this...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, nobody is working on couchdb-odm at the moment. I wouldn't count on a stable release anytime soon. With that in mind, I'm not sure if we should add integration for CouchDB at this time.

"doctrine/couchdb-odm-bundle": "@dev",
"phpunit/phpunit": "~4.8|~5.0"
},
"suggest": {
Expand All @@ -52,5 +56,10 @@
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"config": {
"platform": {
"ext-mongo": "1.6.16"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for Mongo ODM, remove.

}
}
}