/**
  * @inheritdoc
  */
 public function install()
 {
     $engine = $this->db->getParameter('engine');
     $collate = $this->db->getParameter('collate');
     $charset = $this->db->getParameter('charset');
     $this->db->exec("\n            CREATE TABLE IF NOT EXISTS `" . $this->tableName . "` (\n            `id` int(11) NOT NULL AUTO_INCREMENT,\n            `name` varchar(150) NOT NULL DEFAULT '',\n            PRIMARY KEY (`id`),\n            UNIQUE KEY by_name (`name`)\n            ) ENGINE={$engine} DEFAULT CHARSET={$charset} COLLATE={$collate}");
     $this->metaFactory->createTable();
 }
Example #2
0
 function testMagicMethods()
 {
     $obj = new \Rocker\Object\PlainObject('testo', 1);
     self::$f->applyMetaData($obj);
     $obj->meta()->key = 'value';
     $this->assertEquals('value', $obj->meta()->key);
     $this->assertTrue($obj->meta()->has('key'));
     $this->assertEquals(null, $obj->meta()->unknownKey);
     self::$f->saveMetaData($obj);
     self::$f->applyMetaData($obj);
     $obj->meta()->key = 'value';
     $this->assertEquals('value', $obj->meta()->key);
     $obj->meta()->key = null;
     $this->assertFalse($obj->meta()->has('key'));
     self::$f->saveMetaData($obj);
     self::$f->applyMetaData($obj);
     $this->assertNull($obj->meta()->key);
     $this->assertFalse($obj->meta()->has('key'));
 }