eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler\SqliteConnectionHandler::getAutoIncrementValue PHP Метод

getAutoIncrementValue() публичный Метод

Returns the value used for autoincrement tables. Usually this will just be null. In case for sequence based RDBMS this method can return a proper value for the given column.
public getAutoIncrementValue ( string $table, string $column ) : mixed
$table string
$column string
Результат mixed
    public function getAutoIncrementValue($table, $column)
    {
        if ($table === 'ezcontentobject_attribute' && $column === 'id') {
            // This is a @HACK -- since this table has a multi-column key with
            // auto-increment, which is not easy to simulate in SQLite. This
            // solves it for now.
            $q = $this->createSelectQuery();
            $q->select($q->expr->max('id'))->from('ezcontentobject_attribute');
            $statement = $q->prepare();
            $statement->execute();
            $this->lastInsertedIds['ezcontentobject_attribute.id'] = (int) $statement->fetchColumn() + 1;
            return $this->lastInsertedIds['ezcontentobject_attribute.id'];
        }
        if ($table === 'ezcontentclass' && $column === 'id') {
            // This is a @HACK -- since this table has a multi-column key with
            // auto-increment, which is not easy to simulate in SQLite. This
            // solves it for now.
            $q = $this->createSelectQuery();
            $q->select($q->expr->max('id'))->from('ezcontentclass');
            $statement = $q->prepare();
            $statement->execute();
            $this->lastInsertedIds['ezcontentclass.id'] = (int) $statement->fetchColumn() + 1;
            return $this->lastInsertedIds['ezcontentclass.id'];
        }
        if ($table === 'ezcontentclass_attribute' && $column === 'id') {
            // This is a @HACK -- since this table has a multi-column key with
            // auto-increment, which is not easy to simulate in SQLite. This
            // solves it for now.
            $q = $this->createSelectQuery();
            $q->select($q->expr->max('id'))->from('ezcontentclass_attribute');
            $statement = $q->prepare();
            $statement->execute();
            $this->lastInsertedIds['ezcontentclass_attribute.id'] = (int) $statement->fetchColumn() + 1;
            return $this->lastInsertedIds['ezcontentclass_attribute.id'];
        }
        return 'NULL';
    }