Setup ID getter by rewrite for tags to return arrays
Tag rewrites can now be set for multiple target tags.
This commit is contained in:
parent
fce933c12a
commit
af454ec013
|
@ -241,23 +241,23 @@ final class NodaIDGetter {
|
||||||
* @param string $lang Language to check in.
|
* @param string $lang Language to check in.
|
||||||
* @param string $name Name of the tag to search for.
|
* @param string $name Name of the tag to search for.
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return array<integer>
|
||||||
*/
|
*/
|
||||||
public static function getTagIDByRewrite(MDMysqli $mysqli_noda, string $lang, string $name):int {
|
public static function getTagIDByRewrite(MDMysqli $mysqli_noda, string $lang, string $name):array {
|
||||||
|
|
||||||
if (empty($name)) return 0;
|
if (empty($name)) return [];
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
$tagRewriteResult = $mysqli_noda->query_by_stmt("
|
$tagRewriteResult = $mysqli_noda->query_by_stmt("
|
||||||
SELECT `tag_id`
|
SELECT `tag_id`
|
||||||
FROM `tag_rewriting`
|
FROM `tag_rewriting`
|
||||||
WHERE `tag_language` = ?
|
WHERE `tag_language` = ?
|
||||||
AND `input_name` = ?
|
AND `input_name` = ?", "ss", $lang, $name);
|
||||||
LIMIT 1", "ss", $lang, $name);
|
|
||||||
|
|
||||||
if ($tagRewriteData = $tagRewriteResult->fetch_row()) {
|
while ($tagRewriteData = $tagRewriteResult->fetch_row()) {
|
||||||
$output = $tagRewriteData[0];
|
$output[] = $tagRewriteData[0];
|
||||||
}
|
}
|
||||||
else $output = 0;
|
|
||||||
|
|
||||||
$tagRewriteResult->close();
|
$tagRewriteResult->close();
|
||||||
$tagRewriteResult = null;
|
$tagRewriteResult = null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user