_init() protected method

protected _init ( )
Beispiel #1
0
 protected function _init()
 {
     $this->_autoConfig[] = 'handlers';
     parent::_init();
     $this->_handlers += array('id' => function ($v) {
         return is_string($v) && preg_match('/^[0-9a-f]{24}$/', $v) ? new MongoId($v) : $v;
     }, 'date' => function ($v) {
         $v = is_numeric($v) ? intval($v) : strtotime($v);
         return !$v ? new MongoDate() : new MongoDate($v);
     }, 'regex' => function ($v) {
         return new MongoRegex($v);
     }, 'integer' => function ($v) {
         return (int) $v;
     }, 'float' => function ($v) {
         return (double) $v;
     }, 'boolean' => function ($v) {
         return (bool) $v;
     }, 'code' => function ($v) {
         return new MongoCode($v);
     }, 'binary' => function ($v) {
         return new MongoBinData($v);
     });
 }