This repository was archived by the owner on May 16, 2018. It is now read-only.
This repository was archived by the owner on May 16, 2018. It is now read-only.
Zend_CodeGenerator_Php_Property_DefaultValue produces unexpected results when using ARRAYS #18
Open
Description
Jira Information
Original Issue: | ZF-12423 |
Issue Type: | Bug |
Reporter: | Jacek Kobus |
Created: | 09/18/12 |
Assignee: | Ralph Schindler |
Components: | Zend_CodeGenerator |
Description
While trying to set an array containing keys like "value", "type" it wrongly interprets it as configuration options.
$test = array (
'id' =>
array (
'SCHEMA_NAME' => NULL,
'TABLE_NAME' => 'user_token',
'COLUMN_NAME' => 'id',
),
'value' =>
array (
'SCHEMA_NAME' => NULL,
'TABLE_NAME' => 'user_token',
'COLUMN_NAME' => 'value',
),
'type' =>
array (
'SCHEMA_NAME' => NULL,
'DATA_TYPE' => 'varchar',
'COLUMN_NAME' => 'type',
),
);
$class = new Zend_CodeGenerator_Php_Class(array(
'name' => 'test',
'properties' => array(
array('name' => '_metadata', 'visiblity' => 'protected', 'defaultValue' => $test)
),
));
While trying to do a workaround I also found that multidimensional arrays are not handled propely as well (#ZF-9440).
$class = new Zend_CodeGenerator_Php_Class(array(
'name' => 'test',
'properties' => array(
array('name' => '_metadata', 'visiblity' => 'protected', 'defaultValue' =>
new Zend_CodeGenerator_Php_Property_DefaultValue(array(
'value' => $test,
'type' => Zend_CodeGenerator_Php_Property_DefaultValue::TYPE_ARRAY
))
)
),
));