Ticket #1295 (closed defect: fixed)

Opened 11 months ago

Last modified 10 months ago

Doctrine_Record::save function not works correctly with the Doctrine::ATTR_QUOTE_IDENTIFIER.

Reported by: abusquets Owned by: romanb
Priority: critical Milestone:
Component: Record Version: 1.0.0
Severity: Keywords:
Cc: Has Test: no
Status: Pending Core Response Has Patch: no

Description

PHP 5.2.5 Apache 2.2 PostgreSQL 8.1 Doctrine 0.11.0

Doctrine_Record::save function not works correctly with the Doctrine::ATTR_QUOTE_IDENTIFIER. When I try to update a retrieved object from database

The sql generated by phpdoctrine is

UPDATE "parcela" SET "41_matri_darp" = 'werwer' WHERE 7_parcela = '1714'

and the correct sql should be

UPDATE "parcela" SET "41_matri_darp" = 'werwer' WHERE "7_parcela" = '1714'

This is my code sample

<?php define('DOCTRINE_PATH', realpath(dirname(file)."/../").DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'Doctrine'); define('SANDBOX_PATH', realpath(dirname(file)."/../").DIRECTORY_SEPARATOR.'application');

define('DATA_FIXTURES_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'doctrine' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'fixtures'); define('MODELS_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'models'); define('MIGRATIONS_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'doctrine' . DIRECTORY_SEPARATOR . 'migrations'); define('SQL_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'doctrine' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'sql'); define('YAML_SCHEMA_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'doctrine' . DIRECTORY_SEPARATOR . 'schema');

define('DSN', ' pgsql://postgres:123456@server:5432/prova');

require_once(DOCTRINE_PATH . DIRECTORY_SEPARATOR . 'Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); Doctrine_Manager::connection(DSN, 'sandbox'); Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER , true);

abstract class BaseParcela? extends Doctrine_Record {

public function setTableDefinition() {

$this->setTableName('parcela'); $this->hasColumn('1_acreedor', 'integer', 4, array('unsigned' => false, 'notnull' => false, 'primary' => false)); $this->hasColumn('2_nom', 'string', 255, array('fixed' => false, 'notnull' => false, 'primary' => false)); $this->hasColumn('3_verema', 'string', 255, array('fixed' => false, 'notnull' => false, 'primary' => false)); $this->hasColumn('4_centre', 'string', 255, array('fixed' => false, 'notnull' => false, 'primary' => false)); $this->hasColumn('5_nom', 'string', 255, array('fixed' => false, 'notnull' => false, 'primary' => false)); $this->hasColumn('6_ind_fina', 'string', 255, array('fixed' => false, 'notnull' => false, 'primary' => false)); $this->hasColumn('7_parcela as id', 'integer', 4, array('unsigned' => false, 'notnull' => true, 'primary' => true)); $this->hasColumn('41_matri_darp as codi', 'string', 255, array('fixed' => false, 'notnull' => false, 'primary' => false));

}

public function setUp() {

parent::setUp();

}

}

class Parcela extends BaseParcela?{}

$taulaParcela = Doctrine::getTable('Parcela'); $registre->codi = $filter->filter( $this->getRequest()->getPost('codi') ); $registre->save();

Change History

Changed 10 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

(In [4827]) fixes #1295

Changed 10 months ago by jwage

  • version changed from 0.11 to 1.0
  • milestone changed from 1.1.0 to 1.0.0-RC2

Changed 10 months ago by anonymous

  • milestone New deleted

Milestone New deleted

Note: See TracTickets for help on using tickets.