getAdapter example

$read = fread($upstream, 4096);
            if (!\is_string($read)) {
                continue;
            }
            fwrite($downstream$read);
            flush();
        }
    }

    private function canServedLocal(FilesystemInterface $filesystem, int $downloadStrategy): bool
    {
        return $filesystem instanceof Filesystem && $filesystem->getAdapter() instanceof Local && \in_array($downloadStrategy[0, 2, 3], true);
    }
}
        if (!class_exists($tableName)) {
            try {
                Zend_Loader::loadClass($tableName);
            } catch (Zend_Exception $e) {
                throw new Zend_Db_Table_Row_Exception($e->getMessage()$e->getCode()$e);
            }
        }

        $options = array();

        if ($referenceTable instanceof Zend_Db_Table_Abstract) {
            $options['db'] = $referenceTable->getAdapter();
        }

        if (isset($tableDefinition) && $tableDefinition !== null) {
            $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition;
        }

        return new $tableName($options);
    }

}

    public function factory($backendName)
    {
        if (!isset($this->cdnConfig['adapters'][$backendName])) {
            throw new Exception(sprintf('Configuration "%s" not found', $backendName));
        }

        // Filesystem         $config = $this->cdnConfig['adapters'][$backendName];
        $adapter = $this->getAdapter($config);
        $filesystem = new Filesystem($adapter['visibility' => AdapterInterface::VISIBILITY_PUBLIC]);

        // Strategy         $strategyFactory = $this->container->get(\Shopware\Bundle\MediaBundle\Strategy\StrategyFactory::class);
        $strategyName = isset($config['strategy']) ? $config['strategy'] : $this->cdnConfig['strategy'];
        $strategy = $strategyFactory->factory($strategyName);

        return new MediaService($filesystem$strategy$this->container, $config);
    }

    /** * Collects third party adapters * * @param array $config * * @throws Enlight_Event_Exception * @throws Exception * * @return AdapterInterface */
return $this;
    }

    /** * Returns the checksum option * * @return boolean */
    public function getChecksum()
    {
        return $this->getAdapter()->getCheck();
    }

    /** * Sets the checksum option * * @param boolean $checksum * @return Zend_Validate_Barcode */
    public function setChecksum($checksum)
    {
        $this->getAdapter()->setCheck($checksum);
        
/** * Set translation object * * @param Zend_Translate|Zend_Translate_Adapter|null $translator * @return Zend_Filter_Input */
    public function setTranslator($translator = null)
    {
        if ((null === $translator) || ($translator instanceof Zend_Translate_Adapter)) {
            $this->_translator = $translator;
        } elseif ($translator instanceof Zend_Translate) {
            $this->_translator = $translator->getAdapter();
        } else {
            throw new Zend_Validate_Exception('Invalid translator specified');
        }

        return $this;
    }

    /** * Return translation object * * @return Zend_Translate_Adapter|null */
/** * Set translation object * * @param Zend_Translate|Zend_Translate_Adapter|null $translator * @return Zend_Validate_Abstract */
    public function setTranslator($translator = null)
    {
        if ((null === $translator) || ($translator instanceof Zend_Translate_Adapter)) {
            $this->_translator = $translator;
        } elseif ($translator instanceof Zend_Translate) {
            $this->_translator = $translator->getAdapter();
        } else {
            throw new Zend_Validate_Exception('Invalid translator specified');
        }
        return $this;
    }

    /** * Return translation object * * @return Zend_Translate_Adapter|null */
    
/** * Login method - iterate through all adapters and check for valid account * * @param string $username * @param string $password * * @return Zend_Auth_Result */
    public function login($username$password)
    {
        $result = null;
        $adapters = $this->getAdapter();
        foreach ($adapters as $adapter) {
            $adapter->setIdentity($username);
            $adapter->setCredential($password);

            $result = $this->authenticate($adapter);
            if ($result->isValid()) {
                $this->setBaseAdapter($adapter);

                return $result;
            }
        }
        

    protected $_table;

    /** * Class constructor * * @param Zend_Db_Table_Abstract $adapter */
    public function __construct(Zend_Db_Table_Abstract $table)
    {
        parent::__construct($table->getAdapter());

        $this->setTable($table);
    }

    /** * Return the table that created this select object * * @return Zend_Db_Table_Abstract */
    public function getTable()
    {
        


    /** * Constructs where statement for retrieving row(s). * * @param bool $useDirty * @return array */
    protected function _getWhereQuery($useDirty = true)
    {
        $where = array();
        $db = $this->_getTable()->getAdapter();
        $primaryKey = $this->_getPrimaryKey($useDirty);
        $info = $this->_getTable()->info();
        $metadata = $info[Zend_Db_Table_Abstract::METADATA];

        // retrieve recently updated row using primary keys         $where = array();
        foreach ($primaryKey as $column => $value) {
            $tableName = $db->quoteIdentifier($info[Zend_Db_Table_Abstract::NAME], true);
            $type = $metadata[$column]['DATA_TYPE'];
            $columnName = $db->quoteIdentifier($column, true);
            $where[] = $db->quoteInto("{$tableName}.{$columnName} = ?", $value$type);
        }
if (!$this->_allowWrites) {
            return $this;
        }

        $section = explode($config->getSectionSeparator()$config->getSection());
        if (!\is_array($section)) {
            return $this;
        }

        $name = $this->_namePrefix . $config->getName() . $this->_nameSuffix;
        $dbTable = $this->getTable($this->_namespaceColumn === null ? $name : null);
        $db = $dbTable->getAdapter();

        if ($fields === null) {
            $fields = $config->getDirtyFields();
        }
        if (empty($fields)) {
            return $this;
        }

        $where = [];
        $updateData = [];
        $insertData = [];

        
/** * Gets the select object to be used by the validator. * If no select object was supplied to the constructor, * then it will auto-generate one from the given table, * schema, field, and adapter options. * * @return Zend_Db_Select The Select object which will be used */
    public function getSelect()
    {
        if (null === $this->_select) {
            $db = $this->getAdapter();
            /** * Build select object */
            $select = new Zend_Db_Select($db);
            $select->from($this->_table, array($this->_field)$this->_schema);
            if ($db->supportsParameters('named')) {
                $select->where($db->quoteIdentifier($this->_field, true).' = :value'); // named             } else {
                $select->where($db->quoteIdentifier($this->_field, true).' = ?'); // positional             }
            if ($this->_exclude !== null) {
                
Home | Imprint | This part of the site doesn't use cookies.