Skip to content

Wildcard support #113

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

Merged
merged 6 commits into from
Dec 19, 2014
Merged

Wildcard support #113

merged 6 commits into from
Dec 19, 2014

Conversation

dantleech
Copy link
Member

Closes: #80

Support wildcards via. the CMF resource bundles PhpcrTraversalFinder
class.

Todo:

  • Node list
  • Node remove
  • ... all operatons that accept a path

For node:list:

PHPCRSH > ls tests_general_base/*/jcr:primaryType
/tests_general_base/daniel
+-----------------+------+-----------------+
| jcr:primaryType | NAME | nt:unstructured |
+-----------------+------+-----------------+
/tests_general_base/index.txt
+-----------------+------+---------+
| jcr:primaryType | NAME | nt:file |
+-----------------+------+---------+
/tests_general_base/idExample
+-----------------+------+---------+
| jcr:primaryType | NAME | nt:file |
+-----------------+------+---------+
PHPCRSH > ls tests_general_base/numberPropertyNode/*/special*
/tests_general_base/numberPropertyNode/jcr:content
+--------------+--------+---------------------+
| specialChars | STRING | üöäøéáñâêèàçæëìíîïþ |
+--------------+--------+---------------------+

@dantleech dantleech force-pushed the resource branch 2 times, most recently from 5c3bb6a to 6dc5390 Compare December 7, 2014 09:37
@@ -4,6 +4,7 @@ php:
- 5.4

before_script:
- composer require "symfony/symfony" "2.6.*" --no-update
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid the deprecation errors..

Copy link
Member

Choose a reason for hiding this comment

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

@@ -9,6 +9,7 @@
use PHPCR\SimpleCredentials;
use PHPCR\Shell\Transport\TransportRegistryInterface;
use PHPCR\SessionInterface;
use PHPCR\Shell\Query\PhpcrRepository;
Copy link
Member Author

Choose a reason for hiding this comment

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

remove

@dantleech dantleech added this to the v1.0 milestone Dec 8, 2014
@dantleech dantleech mentioned this pull request Dec 8, 2014
@dbu
Copy link
Member

dbu commented Dec 9, 2014

basically I have created the glob/finder classes in cmf-resource, but it makes no sense to include that package here. It would be better to put it in phpcr.

hmm.. actually I wonder if it should be in symfony-cmf -- we could add globbing support to ORM tree implementations..

if we want to split it out, the correct thing would be to have phpcr/finder or phpcr/phpcr-finder and then have a doctrine/glob-finder or whatever describes that well. or just have it in doctrine/phpcr-odm, using the phpcr-finder if that helps. is there code to be shared for orm glob finding? should it be doctrine/glob-finder and then a phpcr-finder built on top of that?

@dantleech
Copy link
Member Author

Hmm. Well, going down that route there should also be ###/globfinder-common and then implementations in phpcr and doctrine. Argh. I am confused.

@dbu
Copy link
Member

dbu commented Dec 9, 2014

doctrine does provide a bunch of generically useful things not tied to object-relational/document-mappers. so doctrine/globfinder could be a thing i guess, if there is enough code to make it worthwile.

@dantleech
Copy link
Member Author

@Ocramius @beberlei do you see any value in adding this library to the Doctrine organization?

It is a library for finding documents based on glob patterns (e.g. $finder->find('/*/foo*')) There are currently implementations for PHPCR + PHPCR-ODM.

@Ocramius
Copy link

Ocramius commented Dec 9, 2014

@dantleech yes, it could be moved to common if there is an interface that could be re-implemented in various other persistence layers.

@dbu
Copy link
Member

dbu commented Dec 9, 2014

maybe we should move Symfony\Cmf\Component\Resource\FinderInterface into that library then?
how does this relate to other finder stuff like puli or the symfony finder? not related at all, different concept?

@dantleech
Copy link
Member Author

Yeah the FinderInterface would be a part of this. But if we move it to commons it means that people who only use it for PHPCR (as in this PR) have to pull in the whole of Doctrine commons.

@Ocramius
Copy link

Ocramius commented Dec 9, 2014

I would avoid coupling with the Symfony root namespace (or any other external namespace).

What about defining a package like phpcr (only interfaces) for finder-related tasks?

@dantleech
Copy link
Member Author

Well, the concept could apply equally to any hierarchical data stores, so I wouldn't feel strongly about putting it in a phpcr package.

@Ocramius
Copy link

Ocramius commented Dec 9, 2014

like phpcr: doesn't need to include phpcr in its name

@Ocramius
Copy link

Ocramius commented Dec 9, 2014

Also: we can discuss this on friday/saturday if you are at the mayflower hackaton

@dantleech
Copy link
Member Author

I guess the place that makes most sense would be doctrine/glob-finder although maybe it would just be easier to put it in my own namespace. But yeah, we can all speak about it on Friday :)

@dbu
Copy link
Member

dbu commented Dec 9, 2014

there are a couple of separate libraries in doctrine, like annotations. i would prefer to have this in the doctrine organization, as a statement to its role as general glob finder for database-like things. but yeah, lets see on friday :-)

$level = error_reporting(0);
$helper = parent::get($name);
error_reporting($level);
return $helper;
Copy link
Member Author

Choose a reason for hiding this comment

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

hmm.. remove this workaround

dantleech added a commit that referenced this pull request Dec 19, 2014
@dantleech dantleech merged commit 12cfce5 into master Dec 19, 2014
@dantleech dantleech deleted the resource branch December 19, 2014 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support globbing
4 participants