本文整理汇总了PHP中eZ\Publish\Core\Persistence\Database\DatabaseHandler::getAutoIncrementValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseHandler::getAutoIncrementValue方法的具体用法?PHP DatabaseHandler::getAutoIncrementValue怎么用?PHP DatabaseHandler::getAutoIncrementValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\Core\Persistence\Database\DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler::getAutoIncrementValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertUrlWildcard
/**
* Inserts the given UrlWildcard.
*
* @param \eZ\Publish\SPI\Persistence\Content\UrlWildcard $urlWildcard
*
* @return mixed
*/
public function insertUrlWildcard(UrlWildcard $urlWildcard)
{
/** @var $query \eZ\Publish\Core\Persistence\Database\InsertQuery */
$query = $this->dbHandler->createInsertQuery();
$query->insertInto($this->dbHandler->quoteTable('ezurlwildcard'))->set($this->dbHandler->quoteColumn('destination_url'), $query->bindValue(trim($urlWildcard->destinationUrl, '/ '), null, \PDO::PARAM_STR))->set($this->dbHandler->quoteColumn('id'), $this->dbHandler->getAutoIncrementValue('ezurlwildcard', 'id'))->set($this->dbHandler->quoteColumn('source_url'), $query->bindValue(trim($urlWildcard->sourceUrl, '/ '), null, \PDO::PARAM_STR))->set($this->dbHandler->quoteColumn('type'), $query->bindValue($urlWildcard->forward ? 1 : 2, null, \PDO::PARAM_INT));
$query->prepare()->execute();
return $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName('ezurlwildcard', 'id'));
}
示例2: insertRelation
/**
* Inserts a new relation database record.
*
* @param \eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct
*
* @return int ID the inserted ID
*/
public function insertRelation(RelationCreateStruct $createStruct)
{
$q = $this->dbHandler->createInsertQuery();
$q->insertInto($this->dbHandler->quoteTable('ezcontentobject_link'))->set($this->dbHandler->quoteColumn('id'), $this->dbHandler->getAutoIncrementValue('ezcontentobject_link', 'id'))->set($this->dbHandler->quoteColumn('contentclassattribute_id'), $q->bindValue((int) $createStruct->sourceFieldDefinitionId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('from_contentobject_id'), $q->bindValue($createStruct->sourceContentId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('from_contentobject_version'), $q->bindValue($createStruct->sourceContentVersionNo, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('relation_type'), $q->bindValue($createStruct->type, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('to_contentobject_id'), $q->bindValue($createStruct->destinationContentId, null, \PDO::PARAM_INT));
$q->prepare()->execute();
return $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName('ezcontentobject_link', 'id'));
}
示例3: createNodeAssignment
/**
* Create an entry in the node assignment table.
*
* @param \eZ\Publish\SPI\Persistence\Content\Location\CreateStruct $createStruct
* @param mixed $parentNodeId
* @param int $type
*/
public function createNodeAssignment(CreateStruct $createStruct, $parentNodeId, $type = self::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP)
{
$isMain = $createStruct->mainLocationId === true ? 1 : 0;
$query = $this->handler->createInsertQuery();
$query->insertInto($this->handler->quoteTable('eznode_assignment'))->set($this->handler->quoteColumn('contentobject_id'), $query->bindValue($createStruct->contentId, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('contentobject_version'), $query->bindValue($createStruct->contentVersion, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('from_node_id'), $query->bindValue(0, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('id'), $this->handler->getAutoIncrementValue('eznode_assignment', 'id'))->set($this->handler->quoteColumn('is_main'), $query->bindValue($isMain, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('op_code'), $query->bindValue($type, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('parent_node'), $query->bindValue($parentNodeId, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('parent_remote_id'), $query->bindValue($createStruct->remoteId, null, \PDO::PARAM_STR))->set($this->handler->quoteColumn('remote_id'), $query->bindValue('0', null, \PDO::PARAM_STR))->set($this->handler->quoteColumn('sort_field'), $query->bindValue($createStruct->sortField, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('sort_order'), $query->bindValue($createStruct->sortOrder, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('priority'), $query->bindValue($createStruct->priority, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('is_hidden'), $query->bindValue($createStruct->hidden, null, \PDO::PARAM_INT));
$query->prepare()->execute();
}
示例4: insertObjectStateGroup
/**
* Inserts a new object state group into database
*
* @param \eZ\Publish\SPI\Persistence\Content\ObjectState\Group $objectStateGroup
*/
public function insertObjectStateGroup(Group $objectStateGroup)
{
$query = $this->dbHandler->createInsertQuery();
$query->insertInto($this->dbHandler->quoteTable('ezcobj_state_group'))->set($this->dbHandler->quoteColumn('id'), $this->dbHandler->getAutoIncrementValue('ezcobj_state_group', 'id'))->set($this->dbHandler->quoteColumn('default_language_id'), $query->bindValue($this->maskGenerator->generateLanguageIndicator($objectStateGroup->defaultLanguage, false), null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('identifier'), $query->bindValue($objectStateGroup->identifier))->set($this->dbHandler->quoteColumn('language_mask'), $query->bindValue($this->generateLanguageMask($objectStateGroup->languageCodes), null, \PDO::PARAM_INT));
$query->prepare()->execute();
$objectStateGroup->id = (int) $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName('ezcobj_state_group', 'id'));
$this->insertObjectStateGroupTranslations($objectStateGroup);
}
示例5: insertFieldDefinition
/**
* Inserts a $fieldDefinition for $typeId.
*
* @param mixed $typeId
* @param int $status
* @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition
* @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageFieldDef
*
* @return mixed Field definition ID
*/
public function insertFieldDefinition($typeId, $status, FieldDefinition $fieldDefinition, StorageFieldDefinition $storageFieldDef)
{
$q = $this->dbHandler->createInsertQuery();
$q->insertInto($this->dbHandler->quoteTable('ezcontentclass_attribute'));
$q->set($this->dbHandler->quoteColumn('id'), isset($fieldDefinition->id) ? $q->bindValue($fieldDefinition->id, null, \PDO::PARAM_INT) : $this->dbHandler->getAutoIncrementValue('ezcontentclass_attribute', 'id'))->set($this->dbHandler->quoteColumn('contentclass_id'), $q->bindValue($typeId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('version'), $q->bindValue($status, null, \PDO::PARAM_INT));
$this->setCommonFieldColumns($q, $fieldDefinition, $storageFieldDef);
$q->prepare()->execute();
if (!isset($fieldDefinition->id)) {
return $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName('ezcontentclass_attribute', 'id'));
}
return $fieldDefinition->id;
}
示例6: createSynonym
/**
* Creates a new synonym using the given $keyword for tag $tag.
*
* @param \Netgen\TagsBundle\SPI\Persistence\Tags\SynonymCreateStruct $createStruct
* @param array $tag
*
* @return \Netgen\TagsBundle\SPI\Persistence\Tags\Tag
*/
public function createSynonym(SynonymCreateStruct $createStruct, array $tag)
{
$query = $this->handler->createInsertQuery();
$query->insertInto($this->handler->quoteTable('eztags'))->set($this->handler->quoteColumn('id'), $this->handler->getAutoIncrementValue('eztags', 'id'))->set($this->handler->quoteColumn('parent_id'), $query->bindValue($tag['parent_id'], null, PDO::PARAM_INT))->set($this->handler->quoteColumn('main_tag_id'), $query->bindValue($createStruct->mainTagId, null, PDO::PARAM_INT))->set($this->handler->quoteColumn('keyword'), $query->bindValue($createStruct->keywords[$createStruct->mainLanguageCode], null, PDO::PARAM_STR))->set($this->handler->quoteColumn('depth'), $query->bindValue($tag['depth'], null, PDO::PARAM_INT))->set($this->handler->quoteColumn('path_string'), $query->bindValue('dummy'))->set($this->handler->quoteColumn('remote_id'), $query->bindValue($createStruct->remoteId, null, PDO::PARAM_STR))->set($this->handler->quoteColumn('main_language_id'), $query->bindValue($this->languageHandler->loadByLanguageCode($createStruct->mainLanguageCode)->id, null, PDO::PARAM_INT))->set($this->handler->quoteColumn('language_mask'), $query->bindValue($this->generateLanguageMask($createStruct->keywords, is_bool($createStruct->alwaysAvailable) ? $createStruct->alwaysAvailable : true), null, PDO::PARAM_INT));
$query->prepare()->execute();
$synonymId = $this->handler->lastInsertId($this->handler->getSequenceName('eztags', 'id'));
$synonymPathString = $this->getSynonymPathString($synonymId, $tag['path_string']);
$query = $this->handler->createUpdateQuery();
$query->update($this->handler->quoteTable('eztags'))->set($this->handler->quoteColumn('path_string'), $query->bindValue($synonymPathString, null, PDO::PARAM_STR))->where($query->expr->eq($this->handler->quoteColumn('id'), $query->bindValue($synonymId, null, PDO::PARAM_INT)));
$query->prepare()->execute();
$this->insertTagKeywords($synonymId, $createStruct->keywords, $createStruct->mainLanguageCode, $createStruct->alwaysAvailable);
return $synonymId;
}
示例7: addPolicyLimitations
/**
* Adds limitations to an existing policy.
*
* @param int $policyId
* @param array $limitations
*/
public function addPolicyLimitations($policyId, array $limitations)
{
foreach ($limitations as $identifier => $values) {
$query = $this->handler->createInsertQuery();
$query->insertInto($this->handler->quoteTable('ezpolicy_limitation'))->set($this->handler->quoteColumn('id'), $this->handler->getAutoIncrementValue('ezpolicy_limitation', 'id'))->set($this->handler->quoteColumn('identifier'), $query->bindValue($identifier))->set($this->handler->quoteColumn('policy_id'), $query->bindValue($policyId, null, \PDO::PARAM_INT));
$query->prepare()->execute();
$limitationId = $this->handler->lastInsertId($this->handler->getSequenceName('ezpolicy_limitation', 'id'));
foreach ($values as $value) {
$query = $this->handler->createInsertQuery();
$query->insertInto($this->handler->quoteTable('ezpolicy_limitation_value'))->set($this->handler->quoteColumn('id'), $this->handler->getAutoIncrementValue('ezpolicy_limitation_value', 'id'))->set($this->handler->quoteColumn('value'), $query->bindValue($value))->set($this->handler->quoteColumn('limitation_id'), $query->bindValue($limitationId, null, \PDO::PARAM_INT));
$query->prepare()->execute();
}
}
}