Conditions | 1 |
Paths | 1 |
Total Lines | 38 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | public function init() |
||
14 | { |
||
15 | $di = new Anax\DI\CDIFactoryDefault(); |
||
16 | |||
17 | $di->setShared('db', function() { |
||
18 | $db = new \Mos\Database\CDatabaseBasic(); |
||
19 | $db->setOptions(['dsn' => "sqlite:memory::", "verbose" => false]); |
||
20 | $db->connect(); |
||
21 | return $db; |
||
22 | }); |
||
23 | |||
24 | $this->db->dropTableIfExists("test"); |
||
|
|||
25 | $this->db->execute(); |
||
26 | $this->db->createTable( |
||
27 | 'test', |
||
28 | [ |
||
29 | 'id' => ['integer', 'auto_increment', 'primary key', 'not null'], |
||
30 | 'name' => ['varchar(20)'], |
||
31 | 'color' => ['varchar(20)'], |
||
32 | ] |
||
33 | ); |
||
34 | $this->db->execute(); |
||
35 | $this->db->insert( |
||
36 | 'test', |
||
37 | ['name', 'color'] |
||
38 | ); |
||
39 | $this->db->execute(['Sofia', 'Red']); |
||
40 | $this->db->execute(['Olle', 'Blue']); |
||
41 | |||
42 | |||
43 | /* |
||
44 | $this->db->select("*") |
||
45 | ->from("test") |
||
46 | ; |
||
47 | var_dump($this->db->executeFetchAll()); |
||
48 | */ |
||
49 | |||
50 | } |
||
51 | |||
52 | } |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.