Skip to content

Commit

Permalink
remove obsolete method, added a todo
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Jan 18, 2013
1 parent f7c1caf commit 354461d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog Changelog
========= =========


2013-01-18
----------

* Removed DocumentRepository->getDocumentsByQuery as it is no longer needed.
createQuery returns you an ODM query that can find documents directly.
To get documents from a PHPCR query there is DocumentManager->getDocumentsByPhpcrQuery()

2013-01-13 2013-01-13
---------- ----------


Expand Down
15 changes: 3 additions & 12 deletions lib/Doctrine/ODM/PHPCR/DocumentRepository.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ public function escapeFullText($string)
* @param string $statement the SQL2 statement * @param string $statement the SQL2 statement
* @param string $language (see QueryInterface for list of supported types) * @param string $language (see QueryInterface for list of supported types)
* @param bool $replaceWithFieldnames if * should be replaced with Fieldnames automatically * @param bool $replaceWithFieldnames if * should be replaced with Fieldnames automatically
* @return PHPCR\Query\QueryResultInterface *
* @return Query
*/ */
public function createQuery($statement, $language, $options = 0) public function createQuery($statement, $language, $options = 0)
{ {
// TODO: refactor this to use the odm query builder

This comment has been minimized.

Copy link
@dbu

dbu Jan 18, 2013

Author Member

@dantleech if you could do this, would be awesome!

This comment has been minimized.

Copy link
@dantleech

dantleech Jan 18, 2013

Contributor

Yeah, I think this is one of those things that we will get for free if we carry on evolving the ODM. e.g. if we implement DQL, that would be accepted here and this use case would be pushed down to the PHPCR level.

$qb = $this->dm->createPhpcrQueryBuilder()->setFromQuery($statement, $language); $qb = $this->dm->createPhpcrQueryBuilder()->setFromQuery($statement, $language);
if ($options & self::QUERY_REPLACE_WITH_FIELDNAMES) { if ($options & self::QUERY_REPLACE_WITH_FIELDNAMES) {
$columns = $qb->getColumns(); $columns = $qb->getColumns();
Expand All @@ -269,17 +271,6 @@ public function createQuery($statement, $language, $options = 0)
return new Query($qb->getQuery(), $this->getDocumentManager()); return new Query($qb->getQuery(), $this->getDocumentManager());
} }


/**
* Get documents from a PHPCR query instance
*
* @param \PHPCR\Query\QueryResultInterface $result
* @return array of document instances
*/
public function getDocumentsByQuery(\PHPCR\Query\QueryInterface $query)
{
return $this->dm->getDocumentsByQuery($query, $this->className);
}

/** /**
* Create a QueryBuilder that is prepopulated for this repositories document * Create a QueryBuilder that is prepopulated for this repositories document
* *
Expand Down

0 comments on commit 354461d

Please sign in to comment.