Skip to content
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
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ matrix:
- php: 7.0
env: PHPCS=1 DEFAULT=0

- php: 7.0
env: PHPSTAN=1 DEFAULT=0

before_script:
- if [[ $TRAVIS_PHP_VERSION != 7.0 ]]; then phpenv config-rm xdebug.ini; fi

- composer install --prefer-dist --no-interaction
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan; fi
- if [[ $PHPSTAN != 1 ]]; then composer install --no-interaction; fi

script:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.0 ]]; then ./vendor/bin/phpunit; fi

- if [[ $PHPCS = 1 ]]; then ./vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi

- if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -l 2 src; fi

after_success:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then bash <(curl -s https://codecov.io/bash); fi

Expand Down
7 changes: 7 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

class Connection
{
/**
* Driver
*
* @var \Muffin\Webservice\AbstractDriver
*/
protected $_driver;

/**
* Constructor
*
Expand Down
3 changes: 2 additions & 1 deletion src/Marshaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use ArrayObject;
use Cake\Collection\Collection;
use Cake\Datasource\EntityInterface;
use Cake\Datasource\InvalidPropertyInterface;
use Muffin\Webservice\Model\Endpoint;
use RuntimeException;

Expand Down Expand Up @@ -211,7 +212,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
$properties = [];
foreach ($data as $key => $value) {
if (!empty($errors[$key])) {
if (method_exists($entity, 'invalid')) {
if ($entity instanceof InvalidPropertyInterface) {
$entity->invalid($key, $value);
}
continue;
Expand Down
9 changes: 4 additions & 5 deletions src/Model/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,11 @@ public function endpoint($endpoint = null)
*/
public function alias($alias = null)
{
if ($alias === null) {
return $this->_alias;
if ($alias !== null) {
$this->_alias = $alias;
}

$this->_alias = $alias;

return $this;
return $this->_alias;
}

/**
Expand Down Expand Up @@ -968,6 +966,7 @@ protected function _dynamicFinder($method, $args)
);
}

$conditions = [];
if ($hasOr === false && $hasAnd === false) {
$conditions = $makeConditions([$fields], $args);
} elseif ($hasOr !== false) {
Expand Down
2 changes: 1 addition & 1 deletion src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function firstOrFail()
* @param string $field The field to alias.
* @param null $alias Not being used
*
* @return string The field prefixed with the endpoint alias.
* @return array The field prefixed with the endpoint alias.
*/
public function aliasField($field, $alias = null)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Muffin\Webservice;

use Cake\Database\Type;

/**
* Represents a single endpoint in a database schema.
*
Expand Down Expand Up @@ -226,7 +228,7 @@ public function columnType($name, $type = null)
* based upon.
*
* @param string $column The column name to get the base type from
* @return string The base type name
* @return string|null The base type name
*/
public function baseColumnType($column)
{
Expand Down