Skip to content

Commit

Permalink
update typerocket core
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindees committed Aug 7, 2022
1 parent 8621516 commit 5411363
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 30 deletions.
4 changes: 2 additions & 2 deletions typerocket-v5.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: TypeRocket - Andromeda
Plugin URI: https://typerocket.com/
Description: TypeRocket is a framework that joins refined UI elements and modern programming architecture together.
Version: 5.1.5
Version: 5.1.6
Requires at least: 6.0
Requires PHP: 7.4
Author: TypeRocket
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __construct()
return;
}

define('TYPEROCKET_PLUGIN_VERSION', '5.1.5');
define('TYPEROCKET_PLUGIN_VERSION', '5.1.6');
define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);

if(!defined('TYPEROCKET_ROOT_WP'))
Expand Down
12 changes: 6 additions & 6 deletions typerocket/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions typerocket/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2963,17 +2963,17 @@
},
{
"name": "typerocket/core",
"version": "v5.1.11",
"version_normalized": "5.1.11.0",
"version": "v5.1.13",
"version_normalized": "5.1.13.0",
"source": {
"type": "git",
"url": "https://github.com/TypeRocket/core.git",
"reference": "bac282d3abab5c919ec543bc84a2ab12ab1e8a4f"
"reference": "82c0b73cbd39aa3f87d734e8d9f5008672843adc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TypeRocket/core/zipball/bac282d3abab5c919ec543bc84a2ab12ab1e8a4f",
"reference": "bac282d3abab5c919ec543bc84a2ab12ab1e8a4f",
"url": "https://api.github.com/repos/TypeRocket/core/zipball/82c0b73cbd39aa3f87d734e8d9f5008672843adc",
"reference": "82c0b73cbd39aa3f87d734e8d9f5008672843adc",
"shasum": ""
},
"require": {
Expand All @@ -2987,7 +2987,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"time": "2022-08-04T14:21:35+00:00",
"time": "2022-08-06T23:52:14+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -3016,7 +3016,7 @@
"support": {
"docs": "https://typerocket.com/docs/v5/",
"issues": "https://github.com/TypeRocket/core/issues",
"source": "https://github.com/TypeRocket/core/tree/v5.1.11"
"source": "https://github.com/TypeRocket/core/tree/v5.1.13"
},
"install-path": "../typerocket/core"
},
Expand Down
10 changes: 5 additions & 5 deletions typerocket/vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '652a3e6b6031e275fee0c4cdcbad4e54831dbe56',
'reference' => '8621516a9ea1675c3b4b34631733edeb49f4df5b',
'name' => 'typerocket/typerocket',
'dev' => true,
),
Expand Down Expand Up @@ -404,12 +404,12 @@
'dev_requirement' => true,
),
'typerocket/core' => array(
'pretty_version' => 'v5.1.11',
'version' => '5.1.11.0',
'pretty_version' => 'v5.1.13',
'version' => '5.1.13.0',
'type' => 'library',
'install_path' => __DIR__ . '/../typerocket/core',
'aliases' => array(),
'reference' => 'bac282d3abab5c919ec543bc84a2ab12ab1e8a4f',
'reference' => '82c0b73cbd39aa3f87d734e8d9f5008672843adc',
'dev_requirement' => false,
),
'typerocket/typerocket' => array(
Expand All @@ -418,7 +418,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '652a3e6b6031e275fee0c4cdcbad4e54831dbe56',
'reference' => '8621516a9ea1675c3b4b34631733edeb49f4df5b',
'dev_requirement' => false,
),
'webmozart/assert' => array(
Expand Down
4 changes: 4 additions & 0 deletions typerocket/vendor/typerocket/core/src/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public function addFromConfig(?string $name, ?array $config = null)
if(is_null($config) || is_null($name)) {
$drivers = Config::getFromContainer()->locate('database.drivers');
$config = $drivers[$name] ?? Config::getFromContainer()->locate('database.default');

if($name && !$drivers && !$config) {
throw new \Error(__("TypeRocket database connection configuration not found for \"{$name}\"", 'typerocket-core'));
}
}

/** @var DatabaseConnector $connector */
Expand Down
3 changes: 1 addition & 2 deletions typerocket/vendor/typerocket/core/src/Database/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ public function __construct($table = null, $selectTable = null, $idColumn = null
protected function establishConnection()
{
$connection = Connection::getFromContainer();
$name = $this->connection;

if(!is_string($name) || !$connection->exists($name)) {
if(!$name = $this->connection) {
return $connection->default();
}

Expand Down
25 changes: 17 additions & 8 deletions typerocket/vendor/typerocket/core/src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ protected function establishConnection()
$connection = Connection::getFromContainer();
$name = $this->connection;

if(!is_string($name) || !$connection->exists($name)) {
if(!$name) {
return $connection->default();
}

Expand Down Expand Up @@ -1967,15 +1967,14 @@ public function getCast( $property )
*/
public function hasOne($modelClass, $id_foreign = null, $scope = null)
{
$id = $this->getID();
/** @var Model $relationship */
$relationship = new $modelClass;
$relationship->setRelatedModel( $this );

if( ! $id_foreign && $this->resource ) {
$id_foreign = $this->resource . '_id';
}

/** @var Model $relationship */
$relationship = new $modelClass;
$relationship->setRelatedModel( $this );
$relationship->relatedBy = [
'type' => 'hasOne',
'query' => [
Expand All @@ -1986,7 +1985,12 @@ public function hasOne($modelClass, $id_foreign = null, $scope = null)
]
];

return $relationship->findAll()->where( $id_foreign, $id)->take(1);
if(is_callable($scope)) {
$scope($relationship);
}

$id = $this->getID();
return $relationship->where( $id_foreign, $id)->take(1);
}

/**
Expand All @@ -2003,6 +2007,11 @@ public function belongsTo($modelClass, $id_local = null, $scope = null)
/** @var Model $relationship */
$relationship = new $modelClass;
$relationship->setRelatedModel( $this );

if( ! $id_local && $relationship->resource ) {
$id_local = $relationship->resource . '_id';
}

$relationship->relatedBy = [
'type' => 'belongsTo',
'query' => [
Expand All @@ -2013,8 +2022,8 @@ public function belongsTo($modelClass, $id_local = null, $scope = null)
]
];

if( ! $id_local && $relationship->resource ) {
$id_local = $relationship->resource . '_id';
if(is_callable($scope)) {
$scope($relationship);
}

$id = $this->getProperty( $id_local );
Expand Down

0 comments on commit 5411363

Please sign in to comment.