safrazik / breeze.server.php

Breeze JS support for PHP applications
MIT License
29 stars 11 forks source link

MetadataBuilder doesn't support simple array data properties #14

Closed christophercr closed 9 years ago

christophercr commented 9 years ago

I'm working on a project which uses BreezeJS and the breeze.server.php bundle to generate the Breeze metadata from Doctrine mappings which is really awesome, but now I'm running into a use case where I need to have a simple array data property, in fact a simple array of strings.

In BreezeJS this is supported via an extra property in the metadata for a certain DataProperty ('isScalar = false" => http://stackoverflow.com/questions/22055013/breeze-js-metadata-by-hand-for-an-array-type) but I can't get this property added via the breeze.php.library as there is no "isScalar" property in the DataProperty class of the library.

Do you think this property could be added to the DataProperty class?

safrazik commented 9 years ago

I think it can be added.

christophercr commented 9 years ago

With the change I propose, if you annotate the property in your PHP class as "array" (already a valid Doctrine data type), then this will be converted into 'isScalar = false' property in the generated metadata.

safrazik commented 9 years ago

Additionally, I had to do some work to support SaveChanges to work with array data type. Also note that there are three types of array data types in Doctrine: serialized array (array), JSON array (json_array) and comma separated simple array (simple_array). I made changes accordingly and tested