Storing array with Doctrine and MongoDB

后端 未结 3 1069
长发绾君心
长发绾君心 2021-01-05 08:44

How can I store an array with Doctrine and Mongo DB?

I do not want reference document, only array.

Example:

Type[ 
     Type1,
     Type2,
           


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-05 09:16

    ...
    use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
    ...
    class MyClass
    {
        /**
         * @MongoDB\Hash
         */
        protected $tags = array();
    }
    

    Besides, you can check out BSPTagBundle if you want a form type that helps you with that type of variable.

提交回复
热议问题