• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Database\DatabaseHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中eZ\Publish\Core\Persistence\Database\DatabaseHandler的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseHandler类的具体用法?PHP DatabaseHandler怎么用?PHP DatabaseHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了DatabaseHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getDatabaseHandler

 /**
  * Get a eZ Doctrine database connection handler.
  *
  * Get a ConnectionHandler, which can be used to interact with the configured
  * database. The database connection string is read from an optional
  * environment variable "DATABASE" and defaults to an in-memory SQLite
  * database.
  *
  * @return \eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler
  */
 public function getDatabaseHandler()
 {
     if (!$this->handler) {
         $this->handler = ConnectionHandler::createFromConnection($this->getDatabaseConnection());
         $this->db = $this->handler->getName();
     }
     return $this->handler;
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:18,代码来源:TestCase.php


示例2: init

 public function init()
 {
     $selectQuery = $this->dbHandler->createSelectQuery();
     $selectQuery->select('filepath')->from($this->dbHandler->quoteTable('ezimagefile'));
     $this->statement = $selectQuery->prepare();
     $this->statement->execute();
 }
开发者ID:blankse,项目名称:ezpublish-kernel-1,代码行数:7,代码来源:LegacyStorageImageFileRowReader.php


示例3: createVersionInfoFindQuery

 /**
  * Creates a select query for content version objects, used for version loading w/o fields.
  *
  * Creates a select query with all necessary joins to fetch a complete
  * content object. Does not apply any WHERE conditions, and does not contain
  * name data as it will lead to large result set {@see createNamesQuery}.
  *
  * @return \eZ\Publish\Core\Persistence\Database\SelectQuery
  */
 public function createVersionInfoFindQuery()
 {
     /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
     $query = $this->dbHandler->createSelectQuery();
     $query->select($this->dbHandler->aliasedColumn($query, 'id', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'version', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'modified', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'creator_id', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'created', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'status', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'contentobject_id', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'initial_language_id', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'language_mask', 'ezcontentobject_version'), $this->dbHandler->aliasedColumn($query, 'main_node_id', 'ezcontentobject_tree'), $this->dbHandler->aliasedColumn($query, 'id', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'contentclass_id', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'section_id', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'owner_id', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'remote_id', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'current_version', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'initial_language_id', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'modified', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'published', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'status', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'name', 'ezcontentobject'), $this->dbHandler->aliasedColumn($query, 'language_mask', 'ezcontentobject'))->from($this->dbHandler->quoteTable('ezcontentobject_version'))->innerJoin($this->dbHandler->quoteTable('ezcontentobject'), $query->expr->eq($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $this->dbHandler->quoteColumn('contentobject_id', 'ezcontentobject_version')))->leftJoin($this->dbHandler->quoteTable('ezcontentobject_tree'), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('contentobject_id', 'ezcontentobject_tree'), $this->dbHandler->quoteColumn('contentobject_id', 'ezcontentobject_version')), $query->expr->eq($this->dbHandler->quoteColumn('main_node_id', 'ezcontentobject_tree'), $this->dbHandler->quoteColumn('node_id', 'ezcontentobject_tree'))));
     return $query;
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:16,代码来源:QueryBuilder.php


示例4: handle

 /**
  * Generates query expression for operator and value of a Field Criterion.
  *
  * @throws \RuntimeException If operator is not handled.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param string $column
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(SelectQuery $query, Criterion $criterion, $column)
 {
     $column = $this->dbHandler->quoteColumn($column);
     switch ($criterion->operator) {
         case Criterion\Operator::IN:
             $filter = $query->expr->in($column, array_map(array($this, 'lowercase'), $criterion->value));
             break;
         case Criterion\Operator::BETWEEN:
             $filter = $query->expr->between($column, $query->bindValue($this->lowercase($criterion->value[0])), $query->bindValue($this->lowercase($criterion->value[1])));
             break;
         case Criterion\Operator::EQ:
         case Criterion\Operator::GT:
         case Criterion\Operator::GTE:
         case Criterion\Operator::LT:
         case Criterion\Operator::LTE:
         case Criterion\Operator::LIKE:
             $operatorFunction = $this->comparatorMap[$criterion->operator];
             $filter = $query->expr->{$operatorFunction}($column, $query->bindValue($this->lowercase($criterion->value)));
             break;
         case Criterion\Operator::CONTAINS:
             $filter = $query->expr->like($column, $query->bindValue("%" . $this->lowercase($criterion->value) . "%"));
             break;
         default:
             throw new RuntimeException("Unknown operator '{$criterion->operator}' for Field criterion handler.");
     }
     return $filter;
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:38,代码来源:Handler.php


示例5: getContentLocationIds

 /**
  * Fetch location Ids for the given content object.
  *
  * @param int $contentObjectId
  * @return array Location nodes Ids
  */
 protected function getContentLocationIds($contentObjectId)
 {
     $query = $this->databaseHandler->createSelectQuery();
     $query->select('node_id')->from($this->databaseHandler->quoteTable(self::CONTENTOBJECT_TREE_TABLE))->where($query->expr->eq('contentobject_id', $contentObjectId));
     $stmt = $query->prepare();
     $stmt->execute();
     $nodeIds = $stmt->fetchAll(PDO::FETCH_COLUMN);
     return is_array($nodeIds) ? array_map('intval', $nodeIds) : [];
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:15,代码来源:Indexer.php


示例6: execute

 /**
  * @param MigrationStep $step
  * @return void
  * @throws \Exception if migration step is not for this type of db
  */
 public function execute(MigrationStep $step)
 {
     parent::execute($step);
     $conn = $this->dbHandler->getConnection();
     // @see http://doctrine-orm.readthedocs.io/projects/doctrine-dbal/en/latest/reference/platforms.html
     $dbType = strtolower(preg_replace('/([0-9]+|Platform)/', '', $conn->getDatabasePlatform()->getName()));
     $dsl = $step->dsl;
     if (!isset($dsl[$dbType])) {
         throw new \Exception("Current database type '{$dbType}' is not supported by the SQL migration");
     }
     $sql = $dsl[$dbType];
     return $conn->exec($sql);
 }
开发者ID:kaliop-uk,项目名称:ezmigrationbundle,代码行数:18,代码来源:SQLExecutor.php


示例7: rollback

 /**
  * Rollback transaction.
  *
  * Rollback transaction, or throw exceptions if no transactions has been started.
  *
  * @throws \RuntimeException If no transaction has been started
  */
 public function rollback()
 {
     try {
         $this->dbHandler->rollback();
         // Clear all caches after rollback
         if ($this->contentTypeHandler instanceof CachingContentTypeHandler) {
             $this->contentTypeHandler->clearCache();
         }
         if ($this->languageHandler instanceof CachingLanguageHandler) {
             $this->languageHandler->clearCache();
         }
     } catch (Exception $e) {
         throw new RuntimeException($e->getMessage(), 0, $e);
     }
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:22,代码来源:TransactionHandler.php


示例8: deleteRelation

 /**
  * Deletes the relation with the given $relationId.
  *
  * @param int $relationId
  * @param int $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
  *                 \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
  *                 \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
  *                 \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
  *
  * @return void
  */
 public function deleteRelation($relationId, $type)
 {
     // Legacy Storage stores COMMON, LINK and EMBED types using bitmask, therefore first load
     // existing relation type by given $relationId for comparison
     /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
     $query = $this->dbHandler->createSelectQuery();
     $query->select($this->dbHandler->quoteColumn("relation_type"))->from($this->dbHandler->quoteTable("ezcontentobject_link"))->where($query->expr->eq($this->dbHandler->quoteColumn("id"), $query->bindValue($relationId, null, \PDO::PARAM_INT)));
     $statement = $query->prepare();
     $statement->execute();
     $loadedRelationType = $statement->fetchColumn();
     if (!$loadedRelationType) {
         return;
     }
     // If relation type matches then delete
     if ($loadedRelationType == $type) {
         /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
         $query = $this->dbHandler->createDeleteQuery();
         $query->deleteFrom("ezcontentobject_link")->where($query->expr->eq($this->dbHandler->quoteColumn("id"), $query->bindValue($relationId, null, \PDO::PARAM_INT)));
         $query->prepare()->execute();
     } else {
         if ($loadedRelationType & $type) {
             /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */
             $query = $this->dbHandler->createUpdateQuery();
             $query->update($this->dbHandler->quoteTable("ezcontentobject_link"))->set($this->dbHandler->quoteColumn("relation_type"), $query->expr->bitAnd($this->dbHandler->quoteColumn("relation_type"), $query->bindValue(~$type, null, \PDO::PARAM_INT)))->where($query->expr->eq($this->dbHandler->quoteColumn("id"), $query->bindValue($relationId, null, \PDO::PARAM_INT)));
             $query->prepare()->execute();
         } else {
             // No match, do nothing
         }
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:41,代码来源:DoctrineDatabase.php


示例9: removePolicyLimitations

 /**
  * Remove all limitations for a policy.
  *
  * @param mixed $policyId
  */
 public function removePolicyLimitations($policyId)
 {
     $query = $this->handler->createSelectQuery();
     $query->select($this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation'), $this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation_value'))->from($this->handler->quoteTable('ezpolicy'))->leftJoin($this->handler->quoteTable('ezpolicy_limitation'), $query->expr->eq($this->handler->quoteColumn('policy_id', 'ezpolicy_limitation'), $this->handler->quoteColumn('id', 'ezpolicy')))->leftJoin($this->handler->quoteTable('ezpolicy_limitation_value'), $query->expr->eq($this->handler->quoteColumn('limitation_id', 'ezpolicy_limitation_value'), $this->handler->quoteColumn('id', 'ezpolicy_limitation')))->where($query->expr->eq($this->handler->quoteColumn('id', 'ezpolicy'), $query->bindValue($policyId, null, \PDO::PARAM_INT)));
     $statement = $query->prepare();
     $statement->execute();
     $limitationIdsSet = array();
     $limitationValuesSet = array();
     while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
         if ($row['ezpolicy_limitation_id'] !== null) {
             $limitationIdsSet[$row['ezpolicy_limitation_id']] = true;
         }
         if ($row['ezpolicy_limitation_value_id'] !== null) {
             $limitationValuesSet[$row['ezpolicy_limitation_value_id']] = true;
         }
     }
     if (!empty($limitationIdsSet)) {
         $query = $this->handler->createDeleteQuery();
         $query->deleteFrom($this->handler->quoteTable('ezpolicy_limitation'))->where($query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationIdsSet)));
         $query->prepare()->execute();
     }
     if (!empty($limitationValuesSet)) {
         $query = $this->handler->createDeleteQuery();
         $query->deleteFrom($this->handler->quoteTable('ezpolicy_limitation_value'))->where($query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationValuesSet)));
         $query->prepare()->execute();
     }
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:32,代码来源:DoctrineDatabase.php


示例10: convertFields

 function convertFields(OutputInterface $output)
 {
     $query = $this->db->createSelectQuery();
     $query->select($query->expr->count('*'));
     $query->from('ezcontentobject_attribute');
     $query->where($query->expr->eq($this->db->quoteIdentifier('data_type_string'), $query->bindValue('ezxmltext', null, PDO::PARAM_STR)));
     $statement = $query->prepare();
     $statement->execute();
     $count = $statement->fetchColumn();
     $output->writeln("Found {$count} field rows to convert.");
     $query = $this->db->createSelectQuery();
     $query->select('*');
     $query->from('ezcontentobject_attribute');
     $query->where($query->expr->eq($this->db->quoteIdentifier('data_type_string'), $query->bindValue('ezxmltext', null, PDO::PARAM_STR)));
     $statement = $query->prepare();
     $statement->execute();
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         if (empty($row['data_text'])) {
             $inputValue = Value::EMPTY_VALUE;
         } else {
             $inputValue = $row['data_text'];
         }
         $converted = $this->convert($inputValue);
         $updateQuery = $this->db->createUpdateQuery();
         $updateQuery->update($this->db->quoteIdentifier('ezcontentobject_attribute'));
         $updateQuery->set($this->db->quoteIdentifier('data_type_string'), $updateQuery->bindValue('ezrichtext', null, PDO::PARAM_STR));
         $updateQuery->set($this->db->quoteIdentifier('data_text'), $updateQuery->bindValue($converted, null, PDO::PARAM_STR));
         $updateQuery->where($updateQuery->expr->lAnd($updateQuery->expr->eq($this->db->quoteIdentifier('id'), $updateQuery->bindValue($row['id'], null, PDO::PARAM_INT)), $updateQuery->expr->eq($this->db->quoteIdentifier('version'), $updateQuery->bindValue($row['version'], null, PDO::PARAM_INT))));
         $updateQuery->prepare()->execute();
         $this->logger->info("Converted ezxmltext field #{$row['id']} to richtext", ['original' => $inputValue, 'converted' => $converted]);
     }
     $output->writeln("Converted {$count} ezxmltext fields to richtext");
 }
开发者ID:ezsystems,项目名称:ezplatform-xmltext-fieldtype,代码行数:33,代码来源:ConvertXmlTextToRichTextCommand.php


示例11: onBuildKernel

 /**
  * Adds settings to the parameters that will be injected into the legacy kernel
  *
  * @param \eZ\Publish\Core\MVC\Legacy\Event\PreBuildKernelEvent $event
  */
 public function onBuildKernel(PreBuildKernelEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     $databaseSettings = $this->legacyDbHandler->getConnection()->getParams();
     $settings = array();
     foreach (array("host" => "Server", "port" => "Port", "user" => "User", "password" => "Password", "dbname" => "Database", "unix_socket" => "Socket", "driver" => "DatabaseImplementation") as $key => $iniKey) {
         if (isset($databaseSettings[$key])) {
             $iniValue = $databaseSettings[$key];
             switch ($key) {
                 case "driver":
                     $driverMap = array('pdo_mysql' => 'ezmysqli', 'pdo_pgsql' => 'ezpostgresql', 'oci8' => 'ezoracle');
                     if (!isset($driverMap[$iniValue])) {
                         throw new RuntimeException("Could not map database driver to Legacy Stack database implementation.\n" . "Expected one of '" . implode("', '", array_keys($driverMap)) . "', got '" . $iniValue . "'.");
                     }
                     $iniValue = $driverMap[$iniValue];
                     break;
             }
             $settings["site.ini/DatabaseSettings/{$iniKey}"] = $iniValue;
         } else {
             switch ($key) {
                 case "unix_socket":
                     $settings["site.ini/DatabaseSettings/{$iniKey}"] = "disabled";
                     break;
             }
         }
     }
     // Image settings
     $settings += $this->getImageSettings();
     // File settings
     $settings += array('site.ini/FileSettings/VarDir' => $this->configResolver->getParameter('var_dir'), 'site.ini/FileSettings/StorageDir' => $this->configResolver->getParameter('storage_dir'));
     // Multisite settings (PathPrefix and co)
     $settings += $this->getMultiSiteSettings();
     // User settings
     $settings["site.ini/UserSettings/AnonymousUserID"] = $this->configResolver->getParameter("anonymous_user_id");
     $event->getParameters()->set("injected-settings", $settings + (array) $event->getParameters()->get("injected-settings"));
     if (class_exists('ezxFormToken')) {
         // Inject csrf protection settings to make sure legacy & symfony stack work together
         if ($this->container->hasParameter('form.type_extension.csrf.enabled') && $this->container->getParameter('form.type_extension.csrf.enabled')) {
             ezxFormToken::setSecret($this->container->getParameter('kernel.secret'));
             ezxFormToken::setFormField($this->container->getParameter('form.type_extension.csrf.field_name'));
         } else {
             ezxFormToken::setIsEnabled(false);
         }
     }
     // Register http cache content/cache event listener
     ezpEvent::getInstance()->attach('content/cache', array($this->gatewayCachePurger, 'purge'));
     ezpEvent::getInstance()->attach('content/cache/all', array($this->gatewayCachePurger, 'purgeAll'));
     // Register persistence cache event listeners
     ezpEvent::getInstance()->attach('content/cache', array($this->persistenceCachePurger, 'content'));
     ezpEvent::getInstance()->attach('content/cache/all', array($this->persistenceCachePurger, 'all'));
     ezpEvent::getInstance()->attach('content/class/cache/all', array($this->persistenceCachePurger, 'contentType'));
     ezpEvent::getInstance()->attach('content/class/cache', array($this->persistenceCachePurger, 'contentType'));
     ezpEvent::getInstance()->attach('content/class/group/cache', array($this->persistenceCachePurger, 'contentTypeGroup'));
     ezpEvent::getInstance()->attach('content/section/cache', array($this->persistenceCachePurger, 'section'));
     ezpEvent::getInstance()->attach('user/cache/all', array($this->persistenceCachePurger, 'user'));
     ezpEvent::getInstance()->attach('content/translations/cache', array($this->persistenceCachePurger, 'languages'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:64,代码来源:Configuration.php


示例12: getContentIdsByContentTypeId

 /**
  * Returns all Content IDs for a given $contentTypeId.
  *
  * @param int $contentTypeId
  *
  * @return int[]
  */
 public function getContentIdsByContentTypeId($contentTypeId)
 {
     $query = $this->dbHandler->createSelectQuery();
     $query->select($this->dbHandler->quoteColumn("id"))->from($this->dbHandler->quoteTable("ezcontentobject"))->where($query->expr->eq($this->dbHandler->quoteColumn("contentclass_id"), $query->bindValue($contentTypeId, null, PDO::PARAM_INT)));
     $statement = $query->prepare();
     $statement->execute();
     return $statement->fetchAll(PDO::FETCH_COLUMN);
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:15,代码来源:DoctrineDatabase.php


示例13: insertTagKeywords

 /**
  * Inserts keywords for tag with provided tag ID.
  *
  * @param mixed $tagId
  * @param array $keywords
  * @param string $mainLanguageCode
  * @param bool $alwaysAvailable
  */
 protected function insertTagKeywords($tagId, array $keywords, $mainLanguageCode, $alwaysAvailable)
 {
     foreach ($keywords as $languageCode => $keyword) {
         $query = $this->handler->createInsertQuery();
         $query->insertInto($this->handler->quoteTable('eztags_keyword'))->set($this->handler->quoteColumn('keyword_id'), $query->bindValue($tagId, null, PDO::PARAM_INT))->set($this->handler->quoteColumn('language_id'), $query->bindValue($this->languageHandler->loadByLanguageCode($languageCode)->id + (int) ($languageCode === $mainLanguageCode && $alwaysAvailable), null, PDO::PARAM_INT))->set($this->handler->quoteColumn('keyword'), $query->bindValue($keyword, null, PDO::PARAM_STR))->set($this->handler->quoteColumn('locale'), $query->bindValue($languageCode, null, PDO::PARAM_STR))->set($this->handler->quoteColumn('status'), $query->bindValue(1, null, PDO::PARAM_INT));
         $query->prepare()->execute();
     }
 }
开发者ID:umanit,项目名称:TagsBundle,代码行数:16,代码来源:DoctrineDatabase.php


示例14: getSearchableFieldMapData

 /**
  * Returns searchable field mapping data
  *
  * @return array
  */
 public function getSearchableFieldMapData()
 {
     $query = $this->dbHandler->createSelectQuery();
     $query->select($this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_definition_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass"), $this->dbHandler->quoteIdentifier("content_type_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("id", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_definition_id")), $this->dbHandler->alias($this->dbHandler->quoteColumn("data_type_string", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_type_identifier")))->from($this->dbHandler->quoteTable("ezcontentclass_attribute"))->innerJoin($this->dbHandler->quoteTable("ezcontentclass"), $query->expr->eq($this->dbHandler->quoteColumn("contentclass_id", "ezcontentclass_attribute"), $this->dbHandler->quoteColumn("id", "ezcontentclass")))->where($query->expr->eq($this->dbHandler->quoteColumn("is_searchable", "ezcontentclass_attribute"), $query->bindValue(1, null, PDO::PARAM_INT)));
     $statement = $query->prepare($query);
     $statement->execute();
     return $statement->fetchAll(\PDO::FETCH_ASSOC);
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:13,代码来源:DoctrineDatabase.php


示例15: getContentInfoList

    /**
     * Get sorted arrays of content IDs, which should be returned
     *
     * @param Criterion $filter
     * @param array $sort
     * @param mixed $offset
     * @param mixed $limit
     * @param mixed $translations
     *
     * @return int[]
     */
    protected function getContentInfoList( Criterion $filter, $sort, $offset, $limit, $translations )
    {
        $query = $this->handler->createSelectQuery();
        $query->selectDistinct(
            'ezcontentobject.*',
            $this->handler->aliasedColumn( $query, 'main_node_id', 'main_tree' )
        );

        if ( $sort !== null )
        {
            $this->sortClauseConverter->applySelect( $query, $sort );
        }

        $query->from(
            $this->handler->quoteTable( 'ezcontentobject' )
        )->innerJoin(
            'ezcontentobject_version',
            'ezcontentobject.id',
            'ezcontentobject_version.contentobject_id'
        )->leftJoin(
            $this->handler->alias(
                $this->handler->quoteTable( 'ezcontentobject_tree' ),
                $this->handler->quoteIdentifier( 'main_tree' )
            ),
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->handler->quoteColumn( "contentobject_id", "main_tree" ),
                    $this->handler->quoteColumn( "id", "ezcontentobject" )
                ),
                $query->expr->eq(
                    $this->handler->quoteColumn( "main_node_id", "main_tree" ),
                    $this->handler->quoteColumn( "node_id", "main_tree" )
                )
            )
        );

        if ( $sort !== null )
        {
            $this->sortClauseConverter->applyJoin( $query, $sort );
        }

        $query->where(
            $this->getQueryCondition( $filter, $query, $translations )
        );

        if ( $sort !== null )
        {
            $this->sortClauseConverter->applyOrderBy( $query );
        }

        $query->limit( $limit, $offset );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll( \PDO::FETCH_ASSOC );
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:68,代码来源:DoctrineDatabase.php


示例16: loadUrlWildcardsData

 /**
  * Loads an array with data about UrlWildcards (paged).
  *
  * @param mixed $offset
  * @param mixed $limit
  *
  * @return array
  */
 public function loadUrlWildcardsData($offset = 0, $limit = -1)
 {
     $limit = $limit === -1 ? self::MAX_LIMIT : $limit;
     /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
     $query = $this->dbHandler->createSelectQuery();
     $query->select('*')->from($this->dbHandler->quoteTable('ezurlwildcard'))->limit($limit > 0 ? $limit : self::MAX_LIMIT, $offset);
     $stmt = $query->prepare();
     $stmt->execute();
     return $stmt->fetchAll(\PDO::FETCH_ASSOC);
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:18,代码来源:DoctrineDatabase.php


示例17: getTotalCount

 /**
  * Returns total results count for $criterion and $sortClauses.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  *
  * @return array
  */
 protected function getTotalCount(Criterion $criterion)
 {
     $query = $this->handler->createSelectQuery();
     $query->select($query->alias($query->expr->count('*'), 'count'))->from($this->handler->quoteTable('ezcontentobject_tree'))->innerJoin('ezcontentobject', 'ezcontentobject_tree.contentobject_id', 'ezcontentobject.id')->innerJoin('ezcontentobject_version', 'ezcontentobject.id', 'ezcontentobject_version.contentobject_id');
     $query->where($this->criteriaConverter->convertCriteria($query, $criterion), $query->expr->eq('ezcontentobject.status', $query->bindValue(1, null, PDO::PARAM_INT)), $query->expr->eq('ezcontentobject_version.status', $query->bindValue(1, null, PDO::PARAM_INT)), $query->expr->neq($this->handler->quoteColumn('depth', 'ezcontentobject_tree'), $query->bindValue(0, null, PDO::PARAM_INT)));
     $statement = $query->prepare();
     $statement->execute();
     $res = $statement->fetchAll(PDO::FETCH_ASSOC);
     return (int) $res[0]['count'];
 }
开发者ID:xcorp1986,项目名称:ezpublish-kernel,代码行数:17,代码来源:DoctrineDatabase.php


示例18: tableExist

 /**
  * Check if a table exists in the database
  *
  * @param string $tableName
  * @return bool
  */
 protected function tableExist($tableName)
 {
     /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */
     $sm = $this->dbHandler->getConnection()->getSchemaManager();
     foreach ($sm->listTables() as $table) {
         if ($table->getName() == $tableName) {
             return true;
         }
     }
     return false;
 }
开发者ID:kaliop-uk,项目名称:ezmigrationbundle,代码行数:17,代码来源:Database.php


示例19: getRelationXmlHashFromDB

 /**
  * @param mixed[] $destinationContentIds
  *
  * @throws \Exception
  *
  * @return array
  */
 protected function getRelationXmlHashFromDB(array $destinationContentIds)
 {
     if (empty($destinationContentIds)) {
         return array();
     }
     $q = $this->db->createSelectQuery();
     $q->select($this->db->aliasedColumn($q, 'id', 'ezcontentobject'), $this->db->aliasedColumn($q, 'remote_id', 'ezcontentobject'), $this->db->aliasedColumn($q, 'current_version', 'ezcontentobject'), $this->db->aliasedColumn($q, 'contentclass_id', 'ezcontentobject'), $this->db->aliasedColumn($q, 'node_id', 'ezcontentobject_tree'), $this->db->aliasedColumn($q, 'parent_node_id', 'ezcontentobject_tree'), $this->db->aliasedColumn($q, 'identifier', 'ezcontentclass'))->from($this->db->quoteTable('ezcontentobject'))->leftJoin($this->db->quoteTable('ezcontentobject_tree'), $q->expr->lAnd($q->expr->eq($this->db->quoteColumn('contentobject_id', 'ezcontentobject_tree'), $this->db->quoteColumn('id', 'ezcontentobject')), $q->expr->eq($this->db->quoteColumn('node_id', 'ezcontentobject_tree'), $this->db->quoteColumn('main_node_id', 'ezcontentobject_tree'))))->leftJoin($this->db->quoteTable('ezcontentclass'), $q->expr->lAnd($q->expr->eq($this->db->quoteColumn('id', 'ezcontentclass'), $this->db->quoteColumn('contentclass_id', 'ezcontentobject')), $q->expr->eq($this->db->quoteColumn('version', 'ezcontentclass'), $q->bindValue(ContentType::STATUS_DEFINED, null, PDO::PARAM_INT))))->where($q->expr->in($this->db->quoteColumn('id', 'ezcontentobject'), $destinationContentIds));
     $stmt = $q->prepare();
     $stmt->execute();
     return $stmt->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_GROUP);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:18,代码来源:RelationListConverter.php


示例20: updateWordObjectCount

 /**
  * Update object count for words (legacy db table: ezsearch_word).
  *
  * @param array $wordId list of word IDs
  * @param array $columns map of columns and values to be updated ([column => value])
  */
 private function updateWordObjectCount(array $wordId, array $columns)
 {
     $query = $this->dbHandler->createUpdateQuery();
     $query->update($this->dbHandler->quoteTable('ezsearch_word'));
     foreach ($columns as $column => $value) {
         $query->set($this->dbHandler->quoteColumn($column), $value);
     }
     $query->where($query->expr->in($this->dbHandler->quoteColumn('id'), $wordId));
     $stmt = $query->prepare();
     $stmt->execute();
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:17,代码来源:SearchIndex.php



注:本文中的eZ\Publish\Core\Persistence\Database\DatabaseHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Database\SelectQuery类代码示例发布时间:2022-05-23
下一篇:
PHP Routing\SimplifiedRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap