/** * Ctor */ public function testCtor() { $hydrator = new ClassMethods(); $this->assertFalse($hydrator->getUnderscoreSeparatedKeys()); $this->assertInstanceOf('\\Matryoshka\\Model\\Wrapper\\Mongo\\Hydrator\\NamingStrategy\\DefaultNamingStrategy', $hydrator->getNamingStrategy()); $this->assertInstanceOf('\\Matryoshka\\Model\\Wrapper\\Mongo\\Hydrator\\Strategy\\MongoIdStrategy', $hydrator->getStrategy('_id')); $hydrator = new ClassMethods(true); $this->assertTrue($hydrator->getUnderscoreSeparatedKeys()); $this->assertInstanceOf('\\Matryoshka\\Model\\Wrapper\\Mongo\\Hydrator\\NamingStrategy\\UnderscoreNamingStrategy', $hydrator->getNamingStrategy()); $this->assertInstanceOf('\\Matryoshka\\Model\\Wrapper\\Mongo\\Hydrator\\Strategy\\MongoIdStrategy', $hydrator->getStrategy('_id')); }
/** * {@inheritdoc} */ public function __construct($underscoreSeparatedKeys = true) { parent::__construct($underscoreSeparatedKeys); // Strategy $this->addStrategy('state', new SetTypeStrategy('string', 'string')); $this->addStrategy('type', new SetTypeStrategy('string', 'string')); $this->addStrategy('recovery', new SetTypeStrategy('bool', 'bool')); $this->addStrategy('error', new HasOneStrategy(new ErrorObject(), true)); }
/** * {@inheritdoc} */ public function __construct($underscoreSeparatedKeys = true) { parent::__construct($underscoreSeparatedKeys); $this->addStrategy('date_created', new MongoDateStrategy()); $this->addStrategy('date_modified', new MongoDateStrategy()); }