Skip to content

Commit 9d57675

Browse files
committed
Update
1 parent 80cbf46 commit 9d57675

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "floatphp/kernel",
3-
"version" : "1.2.2",
3+
"version" : "1.2.3",
44
"type": "library",
55
"description": "FloatPHP Kernel Components",
66
"keywords": ["php","micro-framework","framework","PSR","ORM","jakiboy","composer"],

src/Orm.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,25 @@ public function searchOne($columns = '*', array $sort = []) : array
331331
return $this->getRow($sql);
332332
}
333333

334+
/**
335+
* Search column using binded data,
336+
* Returns 1D array.
337+
*
338+
* @access public
339+
* @param string $column
340+
* @param array $sort
341+
* @param int $limit
342+
* @return array
343+
*/
344+
public function searchColumn(string $column, array $sort = [], ?int $limit = 0) : array
345+
{
346+
$sql = "{$this->getSelectQuery($column)} ";
347+
$sql .= "{$this->getWhereQuery()} ";
348+
$sql .= "{$this->getSortQuery($sort)} ";
349+
$sql .= "{$this->getLimitQuery($limit)};";
350+
return $this->getColumn($sql);
351+
}
352+
334353
/**
335354
* Select distinct rows using binded data.
336355
*

src/TraitConfiguration.php

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,19 @@ protected function getAppDir() : string
172172
}
173173

174174
/**
175-
* Get dir root.
175+
* Get dynamic root path.
176176
*
177177
* @access protected
178+
* @param string $sub
178179
* @return string
179180
*/
180-
protected function getRoot() : string
181+
protected function getRoot(?string $sub = null) : string
181182
{
182-
return dirname($this->getAppDir());
183+
$path = dirname($this->getAppDir());
184+
if ( $sub ) {
185+
$path .= "/{$sub}";
186+
}
187+
return $this->formatPath($path);
183188
}
184189

185190
/**
@@ -438,11 +443,14 @@ protected function getViewExtension() : string
438443
* @access protected
439444
* @return string
440445
*/
441-
protected function getBaseUrl() : string
446+
protected function getBaseUrl(?string $sub = null) : string
442447
{
443448
$url = Server::getBaseUrl();
444-
$route = $this->getBaseRoute();
445-
return $this->untrailingSlash("{$url}/{$route}");
449+
$url = "{$url}/{$this->getBaseRoute()}";
450+
if ( $sub ) {
451+
$url .= "/{$sub}";
452+
}
453+
return $this->formatPath($url, true);
446454
}
447455

448456
/**
@@ -469,6 +477,20 @@ protected function getAssetPath() : string
469477
return $this->formatPath($path, true);
470478
}
471479

480+
/**
481+
* Get public url.
482+
*
483+
* @access protected
484+
* @param string $path
485+
* @return string
486+
*/
487+
protected function getPublicUrl(?string $path = null) : string
488+
{
489+
return $this->formatPath(
490+
"{$this->getBaseUrl()}/public/{$path}"
491+
);
492+
}
493+
472494
/**
473495
* Get front upload url.
474496
*
@@ -540,7 +562,9 @@ protected function getAdminPath(?string $path = null) : string
540562
*/
541563
protected function getPublicPath(?string $path = null) : string
542564
{
543-
return "{$this->getRoot()}/public/{$path}";
565+
return $this->formatPath(
566+
"{$this->getRoot()}/public/{$path}"
567+
);
544568
}
545569

546570
/**

0 commit comments

Comments
 (0)