library/Garp/Model/Db/Snippet.php
public function fetchByIdentifier($identifier) {
        if (!$identifier) {
            throw new InvalidArgumentException('Snippet identifier is required');
        }
        $select = $this->select()->where('identifier = ?', $identifier);
        if ($result = $this->fetchRow($select)) {
            return $result;
        }
        $ignoreMissing = Zend_Registry::get('config')->snippets->ignoreMissing ?? false;
        if (!$ignoreMissing) {
            throw new Exception('Snippet not found: ' . $identifier);
        }
        // Return fallback row, where text is set to $identifier, in order to provide some fallback.
        return $this->createRow([
            'has_text' => 1,
            'text' => $identifier,
        ]);
    }
public function fetchByIdentifier($identifier) {
        if (!$identifier) {
            throw new InvalidArgumentException('Snippet identifier is required');
        }
        $select = $this->select()->where('identifier = ?', $identifier);
        if ($result = $this->fetchRow($select)) {
            return $result;
        }
        $ignoreMissing = Zend_Registry::get('config')->snippets->ignoreMissing ?? false;
        if (!$ignoreMissing) {
            throw new Exception('Snippet not found: ' . $identifier);
        }
        // Return fallback row, where text is set to $identifier, in order to provide some fallback.
        return $this->createRow([
            'has_text' => 1,
            'text' => $identifier,
        ]);
    }
public function fetchByIdentifier ( $ identifier ) { if ( ! $ identifier ) { throw new InvalidArgumentException ( 'Snippet identifier is required' ) ; } $ select = $ this -> select ( ) -> where ( 'identifier = ?' , $ identifier ) ; if ( $ result = $ this -> fetchRow ( $ select ) ) { return $ result ; } $ ignoreMissing = Zend_Registry :: get ( 'config' ) -> snippets -> ignoreMissing ?? false ; if ( ! $ ignoreMissing ) { throw new Exception ( 'Snippet not found: ' . $ identifier ) ; } // Return fallback row, where text is set to $identifier, in order to provide some fallback. return $ this -> createRow ( [ 'has_text' => 1 , 'text' => $ identifier , ] ) ; }
Fetch a snippet by its identifier

@param string $identifier
@return Garp_Db_Table_Row
Fetch a snippet by its identifier