-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #3439023 by mkalkbrenner, drunken monkey: Invalid types "text" …
…and "date" specified in SolrFieldDefinition data defintions
- Loading branch information
1 parent
b9cb010
commit 4976410
Showing
4 changed files
with
72 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Drupal\search_api_solr\Plugin\DataType; | ||
|
||
use Drupal\Core\TypedData\Plugin\DataType\DateTimeIso8601; | ||
|
||
/** | ||
* A data type for Solr date strings. | ||
* | ||
* The plain value of this data type is a date string in ISO 8601 format. | ||
* | ||
* @DataType( | ||
* id = "solr_date", | ||
* label = @Translation("Solr date") | ||
* ) | ||
*/ | ||
class SolrDate extends DateTimeIso8601 { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getValue() { | ||
return \Drupal::service('solarium.query_helper')->formatDate((string) $this->value); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setValue($value, $notify = TRUE) { | ||
parent::setValue(trim($value, 'Z'), $notify); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters