function find_tags_by_keyword($keyword, $tag_type_value = false) { # Find keyword $keyword = find_keyword($keyword); # Find tag type if ($tag_type_value) { $tag_type = find_tag_type($tag_type_value); } # Find tags $tags = TagQuery::create()->filterByKeyword($keyword); if ($tag_type) { $tags->filterByType($tag_type); } $tags->find(); # Return tag return $tags; }
<?php # Include autoloader require_once 'vendor/autoload.php'; # Include config require_once 'generated-conf/config.php'; $verse = find_verse('Genesis 1:4'); $keyword = find_keyword('Jealousy'); $type = find_tag_type('instructs regarding'); $tag = new Tag(); $tag->setKeyword($keyword)->setTagType($type)->setVerse($verse)->save(); var_dump($tag->toArray());