-
Notifications
You must be signed in to change notification settings - Fork 27
/
usage.php
152 lines (118 loc) · 4.57 KB
/
usage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
// Retrieve all entities in the set
$odataClient->entitySet('leads')->get();
// Retrieve a single entity from an entitySet
$odataClient->entitySet('leads')->where('name','John')->first();
// OR
$odataClient->entitySet('leads')->filter('name','John')->top(1);
$odataClient->entitySet('leads')->filter('name','John')->value('emailaddress1');
$odataClient->entitySet('leads')->pluck('emailaddress1');
$odataClient->entitySet('leads')->pluck('emailaddress1', 'email');
$odataClient->entitySet('leads')->count();
$odataClient->entitySet('orders')->max('price');
$price = $odataClient->entitySet('orders')
->where('finalized', 1)
->avg('price');
// Selects
$leads = $odataClient->entitySet('leads')->select('firstname', 'lastname')->get();
// Where clauses
$leads = $odataClient->entitySet('leads')->where('votes', '=', 100)->get();
$leads = $odataClient->entitySet('leads')->filter('votes', '=', 100)->get();
$leads = $odataClient->entitySet('leads')->where('votes', 100)->get();
// Multiple conditions
$leads = $odataClient->entitySet('leads')->where([
['status', '=', '1'],
['subscribed', '<>', '1'],
])->get();
// Or statements
$leads = $odataClient->entitySet('leads')
->where('votes', '>', 100)
->orWhere('name', 'John')
->get();
$leads = $odataClient->entitySet('leads')
->filter('votes', '>', 100)
->or('name', 'John')
->get();
// contains
$leads = $odataClient->entitySet('leads')
->filter('name', 'contains', 'John')
->filter('name', '%', 'John')
->filter('name', '%_%', 'John')
->get();
// endswith
$leads = $odataClient->entitySet('leads')
->filter('name', 'endswith', 'John')
->filter('name', '%_', 'John')
->get();
// startswith
$leads = $odataClient->entitySet('leads')
->filter('name', 'startswith', 'John')
->filter('name', '_%', 'John')
->get();
// indexof
$leads = $odataClient->entitySet('leads')
->filter('firstname', 'indexof', 'John', '=', 1)
->get();
// length
$leads = $odataClient->entitySet('leads')
->filter('firstname', 'length', '=', 4)
->get();
// substring
$leads = $odataClient->entitySet('leads')
->filter('firstname', 'substring', 1, '=', 'ohn')
->get();
$leads = $odataClient->entitySet('leads')
->filter('firstname', 'substring', 1, 2, '=', 'oh')
->get();
// tolower
$leads = $odataClient->entitySet('leads')
->filter('firstname', 'tolower', '=', 'microsoft')
->get();
// toupper
$leads = $odataClient->entitySet('leads')
->filter('firstname', 'toupper', '=', 'MICROSOFT')
->get();
// toupper
$leads = $odataClient->entitySet('leads')
->filter('company', 'trim', '=', 'Microsoft')
->get();
// toupper
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'day', '=', 8)
->get();
// All leads born on the 8th day of the month
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'day', '=', 8)
->get();
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'hour', '=', 4)
->get();
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'minute', '=', 30)
->get();
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'second', '=', 4)
->get();
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'month', '=', 40)
->get();
$leads = $odataClient->entitySet('leads')
->filter('birthday', 'year', '=', 1980)
->get();
$leads = $odataClient->entitySet('orders')
->filter('freight', 'ceiling', '=', 32)
->get();
$leads = $odataClient->entitySet('orders')
->filter('freight', 'floor', '=', 32)
->get();
$leads = $odataClient->entitySet('orders')
->filter('freight', 'round', '=', 32)
->get();
$dynamicsClient->entitySet('leads')->filter('Name','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','=','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','!=','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','>','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','>=','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','<','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','<=','Milk');
$dynamicsClient->entitySet('leads')->filter('Name','<=','Milk')->and();