Skip to content

Loading…

DDC-3242: Initialize the type array #4030

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

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

@doctrinebot

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'];
    }
}
@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by bilou:

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

@Ocramius Ocramius was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.