DDC-3242: Initialize the type array #4030

doctrinebot opened this Issue Aug 7, 2014 · 3 comments

2 participants


Jira issue originally created by user bilou:

Hi there,

I'm having issues with initializing a field in one of my entities whose type is array. Could you just give an example where an array field is initilized with this value for instance (array('un' => 'one', 'deux' => 'two', 'trois' => 'three'))? Because I can't find anything about the array type initilization. Thanks a lot


Comment created by @ocramius:

You just set it in your entities:

class Foo
    private $id;
    private $someArrayField;

    public function **construct()
        $this->someArrayField = ['un' => 'one', 'deux' => 'two', 'trois' => 'three'];

Issue was closed with resolution "Fixed"


Comment created by bilou:

Ok thanks, I thought of initializing into the annotations as for the other types.

@Ocramius Ocramius was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment