Skip to content

Commit 5411363

Browse files
committed
update typerocket core
1 parent 8621516 commit 5411363

7 files changed

Lines changed: 42 additions & 30 deletions

File tree

typerocket-v5.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: TypeRocket - Andromeda
44
Plugin URI: https://typerocket.com/
55
Description: TypeRocket is a framework that joins refined UI elements and modern programming architecture together.
6-
Version: 5.1.5
6+
Version: 5.1.6
77
Requires at least: 6.0
88
Requires PHP: 7.4
99
Author: TypeRocket
@@ -34,7 +34,7 @@ public function __construct()
3434
return;
3535
}
3636

37-
define('TYPEROCKET_PLUGIN_VERSION', '5.1.5');
37+
define('TYPEROCKET_PLUGIN_VERSION', '5.1.6');
3838
define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);
3939

4040
if(!defined('TYPEROCKET_ROOT_WP'))

typerocket/composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typerocket/vendor/composer/installed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,17 +2963,17 @@
29632963
},
29642964
{
29652965
"name": "typerocket/core",
2966-
"version": "v5.1.11",
2967-
"version_normalized": "5.1.11.0",
2966+
"version": "v5.1.13",
2967+
"version_normalized": "5.1.13.0",
29682968
"source": {
29692969
"type": "git",
29702970
"url": "https://github.com/TypeRocket/core.git",
2971-
"reference": "bac282d3abab5c919ec543bc84a2ab12ab1e8a4f"
2971+
"reference": "82c0b73cbd39aa3f87d734e8d9f5008672843adc"
29722972
},
29732973
"dist": {
29742974
"type": "zip",
2975-
"url": "https://api.github.com/repos/TypeRocket/core/zipball/bac282d3abab5c919ec543bc84a2ab12ab1e8a4f",
2976-
"reference": "bac282d3abab5c919ec543bc84a2ab12ab1e8a4f",
2975+
"url": "https://api.github.com/repos/TypeRocket/core/zipball/82c0b73cbd39aa3f87d734e8d9f5008672843adc",
2976+
"reference": "82c0b73cbd39aa3f87d734e8d9f5008672843adc",
29772977
"shasum": ""
29782978
},
29792979
"require": {
@@ -2987,7 +2987,7 @@
29872987
"require-dev": {
29882988
"phpunit/phpunit": "^9.5"
29892989
},
2990-
"time": "2022-08-04T14:21:35+00:00",
2990+
"time": "2022-08-06T23:52:14+00:00",
29912991
"type": "library",
29922992
"installation-source": "dist",
29932993
"autoload": {
@@ -3016,7 +3016,7 @@
30163016
"support": {
30173017
"docs": "https://typerocket.com/docs/v5/",
30183018
"issues": "https://github.com/TypeRocket/core/issues",
3019-
"source": "https://github.com/TypeRocket/core/tree/v5.1.11"
3019+
"source": "https://github.com/TypeRocket/core/tree/v5.1.13"
30203020
},
30213021
"install-path": "../typerocket/core"
30223022
},

typerocket/vendor/composer/installed.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'type' => 'library',
66
'install_path' => __DIR__ . '/../../',
77
'aliases' => array(),
8-
'reference' => '652a3e6b6031e275fee0c4cdcbad4e54831dbe56',
8+
'reference' => '8621516a9ea1675c3b4b34631733edeb49f4df5b',
99
'name' => 'typerocket/typerocket',
1010
'dev' => true,
1111
),
@@ -404,12 +404,12 @@
404404
'dev_requirement' => true,
405405
),
406406
'typerocket/core' => array(
407-
'pretty_version' => 'v5.1.11',
408-
'version' => '5.1.11.0',
407+
'pretty_version' => 'v5.1.13',
408+
'version' => '5.1.13.0',
409409
'type' => 'library',
410410
'install_path' => __DIR__ . '/../typerocket/core',
411411
'aliases' => array(),
412-
'reference' => 'bac282d3abab5c919ec543bc84a2ab12ab1e8a4f',
412+
'reference' => '82c0b73cbd39aa3f87d734e8d9f5008672843adc',
413413
'dev_requirement' => false,
414414
),
415415
'typerocket/typerocket' => array(
@@ -418,7 +418,7 @@
418418
'type' => 'library',
419419
'install_path' => __DIR__ . '/../../',
420420
'aliases' => array(),
421-
'reference' => '652a3e6b6031e275fee0c4cdcbad4e54831dbe56',
421+
'reference' => '8621516a9ea1675c3b4b34631733edeb49f4df5b',
422422
'dev_requirement' => false,
423423
),
424424
'webmozart/assert' => array(

typerocket/vendor/typerocket/core/src/Database/Connection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public function addFromConfig(?string $name, ?array $config = null)
4949
if(is_null($config) || is_null($name)) {
5050
$drivers = Config::getFromContainer()->locate('database.drivers');
5151
$config = $drivers[$name] ?? Config::getFromContainer()->locate('database.default');
52+
53+
if($name && !$drivers && !$config) {
54+
throw new \Error(__("TypeRocket database connection configuration not found for \"{$name}\"", 'typerocket-core'));
55+
}
5256
}
5357

5458
/** @var DatabaseConnector $connector */

typerocket/vendor/typerocket/core/src/Database/Query.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ public function __construct($table = null, $selectTable = null, $idColumn = null
5353
protected function establishConnection()
5454
{
5555
$connection = Connection::getFromContainer();
56-
$name = $this->connection;
5756

58-
if(!is_string($name) || !$connection->exists($name)) {
57+
if(!$name = $this->connection) {
5958
return $connection->default();
6059
}
6160

typerocket/vendor/typerocket/core/src/Models/Model.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ protected function establishConnection()
260260
$connection = Connection::getFromContainer();
261261
$name = $this->connection;
262262

263-
if(!is_string($name) || !$connection->exists($name)) {
263+
if(!$name) {
264264
return $connection->default();
265265
}
266266

@@ -1967,15 +1967,14 @@ public function getCast( $property )
19671967
*/
19681968
public function hasOne($modelClass, $id_foreign = null, $scope = null)
19691969
{
1970-
$id = $this->getID();
1970+
/** @var Model $relationship */
1971+
$relationship = new $modelClass;
1972+
$relationship->setRelatedModel( $this );
19711973

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

1976-
/** @var Model $relationship */
1977-
$relationship = new $modelClass;
1978-
$relationship->setRelatedModel( $this );
19791978
$relationship->relatedBy = [
19801979
'type' => 'hasOne',
19811980
'query' => [
@@ -1986,7 +1985,12 @@ public function hasOne($modelClass, $id_foreign = null, $scope = null)
19861985
]
19871986
];
19881987

1989-
return $relationship->findAll()->where( $id_foreign, $id)->take(1);
1988+
if(is_callable($scope)) {
1989+
$scope($relationship);
1990+
}
1991+
1992+
$id = $this->getID();
1993+
return $relationship->where( $id_foreign, $id)->take(1);
19901994
}
19911995

19921996
/**
@@ -2003,6 +2007,11 @@ public function belongsTo($modelClass, $id_local = null, $scope = null)
20032007
/** @var Model $relationship */
20042008
$relationship = new $modelClass;
20052009
$relationship->setRelatedModel( $this );
2010+
2011+
if( ! $id_local && $relationship->resource ) {
2012+
$id_local = $relationship->resource . '_id';
2013+
}
2014+
20062015
$relationship->relatedBy = [
20072016
'type' => 'belongsTo',
20082017
'query' => [
@@ -2013,8 +2022,8 @@ public function belongsTo($modelClass, $id_local = null, $scope = null)
20132022
]
20142023
];
20152024

2016-
if( ! $id_local && $relationship->resource ) {
2017-
$id_local = $relationship->resource . '_id';
2025+
if(is_callable($scope)) {
2026+
$scope($relationship);
20182027
}
20192028

20202029
$id = $this->getProperty( $id_local );

0 commit comments

Comments
 (0)