public function setUp()
    {
        $this->db = DB::getInstance();
        $this->curl = new CURL(self::URL);
        $this->db->query('
			DELETE FROM owner;
			ALTER SEQUENCE owner_id_seq RESTART 1;
		');
    }
示例#2
0
 public function __construct($class)
 {
     $this->db = DB::getInstance();
     $this->class = $class;
     $reflectionClass = new ReflectionClass($class);
     $docComment = $reflectionClass->getDocComment();
     $docComment = str_replace(' ', '', $docComment);
     if (preg_match('/@Entity/', $docComment)) {
         preg_match('/@Table\\(name="([a-z]+)"\\)/', $docComment, $matches);
         $this->table = $matches[1];
         foreach ($reflectionClass->getProperties() as $reflectionProperty) {
             $field = new stdClass();
             $field->name = $reflectionProperty->getName();
             $docComment = $reflectionProperty->getDocComment();
             $docComment = str_replace(' ', '', $docComment);
             if (!preg_match('/@Transient/', $docComment)) {
                 if (preg_match('/@Id/', $docComment)) {
                     $this->id = $field->name;
                 }
                 preg_match('/@Column\\(name="([a-z_]+)"\\)/', $docComment, $matches);
                 $field->column = $matches[1];
                 if (preg_match('/@NotNull/', $docComment)) {
                     $field->notnull = true;
                 }
                 preg_match('/@Type([a-z]+)/', $docComment, $matches);
                 $field->type = $matches[1];
                 if (preg_match('/@Size\\(max=\\"([a-z]+)\\"\\)/', $docComment, $matches)) {
                     $field->size = $matches[1];
                 }
                 // 					if(preg_match('/@Default(value=\"([a-z]+)\"\)/',$docComment,$matches))
                 // 					{
                 // 						$field->default = $matches[1];
                 // 					}
                 $this->fields[$field->name] = $field;
             }
         }
     }
 }
示例#3
0
 public function setUp()
 {
     $this->db = DB::getInstance();
     $this->dao = new OwnerDAO();
 }
 public function setUp()
 {
     $this->db = DB::getInstance();
     $this->service = new AccountService();
     $this->db->query("INSERT INTO owner VALUES (1, 'temp','temp');");
 }
示例#5
0
 public function setUp()
 {
     $this->db = DB::getInstance();
     $this->service = new OwnerService();
 }