1 | <?php |
||
2 | |||
3 | require __DIR__.'/../vendor/autoload.php'; |
||
4 | require __DIR__.'/config.php'; |
||
5 | require __DIR__.'/Models/User.php'; |
||
6 | |||
7 | /* NOTE: in case of error an exception is thrown */ |
||
8 | |||
9 | use HnrAzevedo\Datamanager\DatamanagerException; |
||
10 | use Model\User; |
||
0 ignored issues
–
show
|
|||
11 | |||
12 | try{ |
||
13 | $entity = new User(); |
||
14 | |||
15 | /* Find by primary key */ |
||
16 | $user = $entity->find(1)->execute()->first()->toEntity(); |
||
17 | |||
18 | /* Search only for columns defined in advance */ |
||
19 | $user = $entity->find(1)->only(['name','email'])->execute()->first(); |
||
20 | $name = $user->name; |
||
21 | $email = $user->email; |
||
22 | /* OR */ |
||
23 | $name = $entity->find()->only('name')->execute()->first()->name; |
||
24 | |||
25 | /* Search except for columns defined in advance */ |
||
26 | $user = $entity->find()->except(['name','email'])->execute()->first(); |
||
27 | /* OR */ |
||
28 | $user = $entity->find()->except('name')->execute()->first(); |
||
29 | |||
30 | /* Limit example */ |
||
31 | $users = $entity->find()->limit(5)->execute()->result(); |
||
32 | /* Offset example */ |
||
33 | $users = $entity->find()->limit(5)->offset(5)->execute()->result(); |
||
34 | |||
35 | /* OrdeBy example */ |
||
36 | $users = $entity->find()->orderBy('birth ASC')->execute()->result(); |
||
37 | /* OR */ |
||
38 | $users = $entity->find()->orderBy('birth','ASC')->execute()->result(); |
||
39 | |||
40 | |||
41 | /* Between example */ |
||
42 | $user = $entity->find()->between([ |
||
43 | 'AND birth'=> [ |
||
44 | '01/01/1996', |
||
45 | '31/12/1996' |
||
46 | ] |
||
47 | ])->execute()->first(); |
||
48 | |||
49 | /* Condition AND is default */ |
||
50 | $user = $entity->find()->between([ |
||
51 | 'birth'=> [ |
||
52 | '01/01/1996', |
||
53 | '31/12/1996' |
||
54 | ] |
||
55 | ])->execute()->first(); |
||
56 | |||
57 | /* Clause IN */ |
||
58 | $user = $entity->find()->where([ |
||
59 | 'birth'=> [ |
||
60 | '01/01/1996', |
||
61 | '31/12/1996' |
||
62 | ] |
||
63 | ])->execute()->first(); |
||
64 | |||
65 | |||
66 | /* Where example */ |
||
67 | $user->find()->where([ |
||
68 | ['name','=','Henri Azevedo'], |
||
69 | 'OR' => [ |
||
70 | 'email','LIKE','[email protected]' |
||
71 | ] |
||
72 | ])->execute(); |
||
73 | |||
74 | /* Searches through all records and returns a result array */ |
||
75 | $results = $entity->find()->execute()->result(); |
||
76 | |||
77 | /* Searches for all records and returns an array of Model\User objects */ |
||
78 | $results = $entity->find()->execute()->toEntity(); |
||
79 | |||
80 | }catch(DatamanagerException $er){ |
||
81 | |||
82 | die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}."); |
||
83 | |||
84 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths