For example these Documents: <pre> class LocationCache { /** * @var array * @ODM\EmbedMany(targetDocument="test\TestBundle\Document \LocationCacheDays") */ protected $days = array();
/** * @param LocationCacheDays */ public function setDays(LocationCacheDays $days) { $day = $days->getDay(); $this->days = array_fill($day, 1, $days); // or: $this->days[$day] = $days; // will create the same resulting document } /** * @return array */ public function getDays() { return $this->days; } } /** * @ODM\EmbeddedDocument */ class LocationCacheDays { /** * @ODM\Int */ protected $day; // Setter /** * @param int */ public function setDay($day) { $this->day = $day; } // Getter /** * @return int */ public function getDay() { return $this->day; } } </pre> Here an example controller. <pre> $locationCache = new LocationCache(); $locationCacheDay = new LocationCacheDays(); $locationCacheDay->setDay(10); $locationCache->setDays($locationCacheDay); $dm->persist($locationCache); </pre> The expacted Document should look like this: <pre> Array ( [_id] => 4e00aa161c911abd4e000001 [days] => Array ( [10] => Array ( [day] => 10 ) ) ) </pre> but it will result in: <pre> Array ( [_id] => 4e00aa161c911abd4e000001 [days] => Array ( [0] => Array ( [day] => 10 ) ) ) </pre> Is there a way to predefine the array_key in an EmbedMay-Document? Thanks in advance -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en