Skip to content

Commit

Permalink
More work to updating to cake 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
bumburoom authored and lorenzo committed May 15, 2018
1 parent 0a9fc1d commit af26c6b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// Attach the document context into FormHelper.
EventManager::instance()->on('View.beforeRender', function ($event) {
$view = $event->subject();
$view = $event->getSubject();
$view->Form->addContextProvider('elastic', function ($request, $data) {
$first = null;
if (is_array($data['entity']) || $data['entity'] instanceof Traversable) {
Expand Down
2 changes: 1 addition & 1 deletion src/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($data = [], $options = [])
'result' => null
];
if (!empty($options['source'])) {
$this->source($options['source']);
$this->setSource($options['source']);
}

if ($options['markNew'] !== null) {
Expand Down
19 changes: 19 additions & 0 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,25 @@ public function simpleQueryString($fields, $string)
return new Elastica\Query\SimpleQueryString($string, (array)$fields);
}

/**
* Returns a Match query object that query documents that have fields containing a match.
*
* ### Example:
*
* {{{
* $builder->match('user.name', 'jose');
* }}}
*
* @param string $field The field to query by.
* @param string $value The match to find in field.
* @return \Elastica\Query\Match
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html
*/
public function match($field, $value)
{
return new Elastica\Query\Match($field, $value);
}

/**
* Returns a Match query object that query documents that have fields containing a match.
*
Expand Down
2 changes: 1 addition & 1 deletion src/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ResultSet extends IteratorIterator implements Countable, JsonSerializable
public function __construct($resultSet, $query)
{
$this->resultSet = $resultSet;
$repo = $query->repository();
$repo = $query->getRepository();
foreach ($repo->embedded() as $embed) {
$this->embeds[$embed->property()] = $embed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public function save(EntityInterface $entity, $options = [])
return $event->result;
}

if ($entity->errors()) {
if ($entity->getErrors()) {
return false;
}

Expand Down

0 comments on commit af26c6b

Please sign in to comment.