Return all verses on a single topic.

@param int|string $mTopic The topic ID or name.
@param bool $bRandomOne Pick a random passage?
@return array|SudoBiblePassage
162744
public function topic($mTopic, $bRandomOne = false)
	{
		// Sanitize input
		if (is_string($mTopic))
			$mTopic = $this->getIdFor('topic', $mTopic);

		// Search
		$q = 'SELECT tv.*, verses.`text`, books.`name` AS book_name, books.`abbr` AS book_abbr, books.`ot`, books.`nt`'
			. ' FROM `sudo_bible_topic_verses` AS tv'
			. ' LEFT JOIN `sudo_bible_verses` AS verses ON verses.`book_id` = tv.`book_id`'
				. ' AND verses.`chapter` = tv.`chapter` AND verses.`verse` = tv.`verse`'
			. ' LEFT JOIN `sudo_bible_books` AS books ON books.`id` = tv.`book_id`'
			. ' WHERE verses.`translation_id` = ? AND tv.`topic_id` = ?'
			. ' ORDER BY `book_id`, `chapter`, `verse`';
		$mResult = $this->runPreparedQuery($q, [$this->iTranslation, $mTopic]);

		// If a random passage was requested, pick one
		if ($bRandomOne) {
			$mResult = new SudoBiblePassage([$mResult[array_rand($mResult)]], $this);
		// Otherwise, convert all from stdClass to SudoBiblePassage
		} else {
			foreach ($mResult as $k => $oResult)
				$mResult[$k] = new SudoBiblePassage([$oResult], $this);
		}

		return $mResult;
	}
1343323
def get(self, wordCategories, aFilter='PV|CLICK|AVGCPC|COMPETITION', nick=None):
        ''''''
        request = TOPRequest('taobao.simba.insight.wordscats.get')
        request['wordCategories'] = wordCategories
        request['filter'] = aFilter
        if nick!=None: request['nick'] = nick
        self.create(self.execute(request))
        return self.result
1223976
public function sendGraphTextByOpenid(array $toUsers, $media_id, $title = "", $description = "", $send_ignore_reprint = 1, $clientmsgid = '')
    {
        $ret = array();
        $ret['touser'] = $toUsers;
        $ret['msgtype'] = 'mpnews';
        $ret['mpnews']['media_id'] = $media_id;
        $ret['mpnews']['title'] = $title;
        $ret['mpnews']['description'] = $description;
        $ret['send_ignore_reprint'] = $send_ignore_reprint;
        $ret['clientmsgid'] = $clientmsgid;
        return $this->send($ret);
    }
129087
public function getCandidatesList (bool $stringMode = false) : array
    {
        if (!$stringMode) :
            return $this->_Candidates;
        else :
            $result = [];

            foreach ($this->_Candidates as $candidateKey => &$oneCandidate) :
                $result[$candidateKey] = $oneCandidate->getName();
            endforeach;

            return $result;
        endif;
    }
944688
public function fetchByAuthor($authorId, Zend_Db_Select $select = null) {
        $select = $select ?: $this->select();
        $select->where('author_id = ?', $authorId);

        $result = $this->fetchAll($select);
        return $result;
    }
750546
private function getAllDocumentsForStrictKeyword($word, $noLimit)
    {
        $query = "SELECT * FROM doclist WHERE term_id = :id ORDER BY hit_count DESC LIMIT {$this->maxDocs}";
        if ($noLimit) {
            $query = "SELECT * FROM doclist WHERE term_id = :id ORDER BY hit_count DESC";
        }
        $stmtDoc = $this->index->prepare($query);

        $stmtDoc->bindValue(':id', $word[0]['id']);
        $stmtDoc->execute();
        return new Collection($stmtDoc->fetchAll(PDO::FETCH_ASSOC));
    }
356626
public static function view_choice($choiceid) {
        global $CFG;

        $params = self::validate_parameters(self::view_choice_parameters(),
                                            array(
                                                'choiceid' => $choiceid
                                            ));
        $warnings = array();

        // Request and permission validation.
        if (!$choice = choice_get_choice($params['choiceid'])) {
            throw new moodle_exception("invalidcoursemodule", "error");
        }
        list($course, $cm) = get_course_and_cm_from_instance($choice, 'choice');

        $context = context_module::instance($cm->id);
        self::validate_context($context);

        // Trigger course_module_viewed event and completion.
        choice_view($choice, $course, $cm, $context);

        $result = array();
        $result['status'] = true;
        $result['warnings'] = $warnings;
        return $result;
    }
660444
public function getFollowedClips($accessToken, $limit = 10, $cursor = null, $trending = false)
    {
        if (!$this->isValidLimit($limit)) {
            throw new InvalidLimitException();
        }

        if ($cursor && !is_string($cursor)) {
            throw new InvalidTypeException('cursor', 'string', gettype($cursor));
        }

        if (!is_bool($trending)) {
            throw new InvalidTypeException('trending', 'boolean', gettype($trending));
        }

        $params = [
            'limit' => (int)$limit,
            'cursor' => $cursor,
            'trending' => $trending ? 'true' : 'false',
        ];

        return $this->get('clips/followed', $params, $accessToken);
    }
591082
public function editAction(Request $request, BrandModel $brandModel)
    {
        
        $deleteForm = $this->createDeleteForm($brandModel);
        $editForm = $this->createForm('EcommerceBundle\Form\BrandModelType', $brandModel);
        $editForm->handleRequest($request);

        if ($editForm->isSubmitted() && $editForm->isValid()) {
            $em = $this->getDoctrine()->getManager();
            
            if($brandModel->getRemoveImage()){
                $brandModel->setImage(null);
            }
            
            $em->persist($brandModel);
            $em->flush();
            
            $this->get('session')->getFlashBag()->add('success', 'model.edited');
            
            return $this->redirectToRoute('ecommerce_brandmodel_show', array('id' => $brandModel->getId()));
        }

        return array(
            'entity' => $brandModel,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
801983
public function getRevisionList(
        $siteId,
        $pageName,
        $pageType = PageTypes::NORMAL,
        $published = false,
        $limit = 10
    ) {
        $draftRevisionQuery = $this->getRevisionQuery(
            $siteId,
            $pageName,
            $pageType,
            $published
        );

        if ($limit > 0) {
            $draftRevisionQuery->setMaxResults($limit);
        }

        try {
            $result = $draftRevisionQuery->getSingleResult(
                \Doctrine\ORM\Query::HYDRATE_ARRAY
            );
        } catch (NoResultException $e) {
            return [];
        }

        return $result;
    }
1143991
public function getSnippet($text, $index, $terms, $options = array())
    {
        $results = $this->getSnippets(array($text), $index, $terms, $options);

        if ($results) {
            return $results[0];
        }

        return false;
    }
830347
private function getAllDocumentsForFuzzyKeyword($words, $noLimit)
    {
        $binding_params = implode(',', array_fill(0, count($words), '?'));
        $query          = "SELECT * FROM doclist WHERE term_id in ($binding_params) ORDER BY CASE term_id";
        $order_counter  = 1;

        foreach ($words as $word) {
            $query .= " WHEN ".$word['id']." THEN ".$order_counter++;
        }

        $query .= " END";

        if (!$noLimit) {
            $query .= " LIMIT {$this->maxDocs}";
        }

        $stmtDoc = $this->index->prepare($query);

        $ids = null;
        foreach ($words as $word) {
            $ids[] = $word['id'];
        }

        $stmtDoc->execute($ids);
        return new Collection($stmtDoc->fetchAll(PDO::FETCH_ASSOC));
    }
867525
def __get_by_info(post_id, catalog_id):
        '''
        
        '''
        recs = TabPost2Tag.select().where(
            (TabPost2Tag.post_id == post_id) &
            (TabPost2Tag.tag_id == catalog_id)
        )

        if recs.count() == 1:
            return recs.get()
        elif recs.count() > 1:
            # return the first one, and delete others.
            out_rec = None
            for rec in recs:
                if out_rec:
                    entry = TabPost2Tag.delete().where(
                        TabPost2Tag.uid == rec.uid
                    )
                    entry.execute()
                else:
                    out_rec = rec
            return out_rec
        return None
1161621
public function getCustomer(PropelPDO $con = null, $doQuery = true)
    {
        if ($this->aCustomer === null && ($this->customer_id !== null) && $doQuery) {
            $this->aCustomer = CustomerQuery::create()->findPk($this->customer_id, $con);
            /* The following can be used additionally to
                guarantee the related object contains a reference
                to this object.  This level of coupling may, however, be
                undesirable since it could result in an only partially populated collection
                in the referenced object.
                $this->aCustomer->addUserCustomerRelations($this);
             */
        }

        return $this->aCustomer;
    }
703619
private void fetchByTitle(Title pTitle, boolean useExactTitle)
		throws WikiApiException
	{
		String searchString = pTitle.getPlainTitle();
		if (!useExactTitle) {
		    searchString = pTitle.getWikiStyleTitle();
		}

		Session session;
		session = this.wiki.__getHibernateSession();
		session.beginTransaction();
		Integer pageId = (Integer) session
				.createNativeQuery(
						"select pml.pageID from PageMapLine as pml where pml.name = :pagetitle LIMIT 1")
				.setParameter("pagetitle", searchString, StringType.INSTANCE).uniqueResult();
		session.getTransaction().commit();

        if (pageId == null) {
			throw new WikiPageNotFoundException("No page with name " + searchString + " was found.");
		}
		fetchByPageId(pageId);
        if (!this.isRedirect&&searchString != null&&!searchString.equals(getTitle().getRawTitleText())) {
                if(this.isRedirect){
                	//in case we already tried to re-retrieve the discussion page unsuccessfully,
                	//we have to give up here or we end up in an infinite loop.
                	
                	//reasons for this happening might be several entries in PageMapLine with the same name but different upper/lower case variants
                	//if the database does not allow case sensitive queries, then the API will always retrieve only the first result and if this is a redirect to a different writing variant, we are stuck in a loop.
                	//To fix this, either a case sensitive collation should be used or the API should be able to deal with set valued results and pick the correct one from the set.
                	//For now, we gracefully return without retrieving the Talk page for this article and throw an appropriate excption.
        			throw new WikiPageNotFoundException("No discussion page with name " + searchString + " could be retrieved. This is most likely due to multiple writing variants of the same page in the database");                	
                }else{
            		this.isRedirect = true;
                    /*
                     * WORKAROUND
                     * in our page is a redirect to a discussion page, we might not retrieve the target discussion page as expected but rather the article associated with the target discussion page
                     * we check this here and re-retrieve the correct page.
                     * this error should be avoided by keeping the namespace information in the database
                     * This fix has been provided by Shiri Dori-Hacohen and is discussed in the Google Group under https://groups.google.com/forum/#!topic/jwpl/2nlr55yp87I/discussion
                     */
                    if (searchString.startsWith(DISCUSSION_PREFIX) && !getTitle().getRawTitleText().startsWith(DISCUSSION_PREFIX)) {
                    	try {
                    		fetchByTitle(new Title(DISCUSSION_PREFIX + getTitle().getRawTitleText()), useExactTitle);
                    	} catch (WikiPageNotFoundException e) {
                    		throw new WikiPageNotFoundException("No page with name " + DISCUSSION_PREFIX + getTitle().getRawTitleText() + " was found.");
                    	}
                    }                	
                }
        }
	}
1298205
protected function _getArticleBundles($oBasketItem)
    {
        $aBundles = [];

        if ($oBasketItem->isBundle()) {
            return $aBundles;
        }

        $oArticle = $oBasketItem->getArticle(true);
        if ($oArticle && $oArticle->oxarticles__oxbundleid->value) {
            $aBundles[$oArticle->oxarticles__oxbundleid->value] = 1;
        }

        return $aBundles;
    }
293221
public static function getTipo($codigo)
    {
        if (isset(self::$impuestos[$codigo]))
            return self::$impuestos[$codigo]['tipo'];
        return false;
    }