Skip to content

Fix querying date properties #198

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 1 commit into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion features/all/phpcr_query.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Execute a query
Then the command should not fail
And I should see a table containing the following rows:
| a.jcr:createdBy |
| admin |
| admin |

Scenario: Execute query invalid language
Given I execute the "query 'SELECT * FROM [nt:unstructured]' --language=FRENCH" command
Expand All @@ -33,3 +33,7 @@ Feature: Execute a query
Scenario: Execute query with no query
Given I execute the "query --language=xpath" command
Then the command should fail

Scenario: Execute query by selecting date property
Given I execute the "query --limit=1 'SELECT [jcr:created] FROM [nt:file]'" command
Then the command should not fail
5 changes: 5 additions & 0 deletions src/PHPCR/Shell/Console/Helper/ResultFormatterHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public function formatQueryResult(QueryResultInterface $result, OutputInterface
], $row->getValues());

foreach ($values as &$value) {
if ($value instanceof \DateTime) {
$value = $value->format('c');
continue;
}

$value = $this->textHelper->truncate($value, 255);
}

Expand Down