lwc / moa

Moa - MongoDB object document mapper
4 stars 0 forks source link

Support for Default Values #1

Open rexmortus opened 11 years ago

rexmortus commented 11 years ago

E.g.

<?
public function properties()
  {
    return array(
      'ispublished' => new Moa\Types\BooleanField(array('required' => true, 'default' => 0))
   }
}
lwc commented 11 years ago

For extra win:

<?php
public function properties()
  {
    return array(
      'isloggedin' => new Moa\Types\BooleanField(array('required' => true, 'default' => function() {
        return Ergo::getActiveUser(); // never actually do this
      }))
   }
}
rexmortus commented 11 years ago

Alternatively, I could implement my own initializer, which probably makes more sense anyways.