Development

#5194 (doctrine:build-model task doesn't allow any global keys schema files)

You must first sign up to be able to contribute.

Ticket #5194 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

doctrine:build-model task doesn't allow any global keys schema files

Reported by: Sapheriel Assigned to: Jonathan.Wage
Priority: minor Milestone: 1.2.1
Component: sfDoctrinePlugin Version: 1.2.0
Keywords: Cc:
Qualification: Unreviewed

Description

The build-model task uses the method _checkForPackageParameter to make sure that project schema files do not use the 'package' keyword either globally or inside each model definition. However, it prevents the definition of all string values at the top level.

Analysis:

The cause is the following line in sfDoctrineBuildModelTask::_checkForPackageParameter():

if ($key == 'package' || isset($value['package']))

If $value happens to be a string, [ 'package' ] is interpreted as a string offset and 'package' is then cast to INT, which is int(0). Therefore, unless $value is an empty string, the expression is true.

Fix:

if ($key == 'package' || (is_array($value) && isset($value['package'])))

Example:

Create a schema file with the following content:

connection: doctrine

TestTable:
  tableName: test_table
  columns:
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true

Change History

12/08/08 00:40:36 changed by Jonathan.Wage

  • milestone set to 1.2.1.

12/09/08 00:06:40 changed by Jonathan.Wage

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

(In [13854]) [1.2] sfDoctrinePlugin: fixes issue with global schema elements (fixes #5194)

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.