initial commit
[namibia] / module / Auction / src / Auction / DataBin / Bid.php
1 <?php
2 namespace Auction\DataBin;
3
4
5
6 /**
7  * Manage Bid data.
8  * @author andre.fourie
9  */
10 class Bid extends \Workspace\Service\DataBin
11 {
12
13         /**
14          * @var array
15          */
16         protected $meta = array(
17                         'Base'        => 'Bid',
18                         'DatasetName' => 'bids',
19                         'Entity'      => '\Auction\Entity\Bid',
20                         'JobField'    => 'auction',
21                         'References'  => array(
22                                         'auction' => '\Auction\Entity\Auction',
23                                         'company' => '\Company\Entity\Company',
24                                         'profile' => '\User\Entity\Profile',
25                                         'autoBid' => '\Auction\Entity\AutoBid'
26                         ),
27                         'Dependants'  => array()
28         );
29         /**
30          * @var array
31         */
32         protected $metaCreate = array(
33                         'Type'          => 'Create',
34                         'Contract'      => 'Recurring',
35                         'ConditionalContract' => array(
36                                         'noBidOnExpiredAuction'
37                         ),
38                         'ExecuteAfter'  => array(
39                                         'updateStatus'
40                         ),
41                         'RequiredInput' => array(
42                                         'Bid' => array(
43                                                         'amount' => 'Decimal'
44                                         )
45                         ),
46                         'OptionalInput' => array()
47         );
48         /**
49          * @var array
50         */
51         protected $metaGrid = array(
52             'Type'          => 'Grid',
53                 'Export'        => true,
54                 'Builder'       => '\Auction\Report\AuctionGrid',
55                 'Writer'        => '\Utility\Export\ExcelReport',
56                 'Output'        => 'Download',
57             'Contract'      => 'Recurring',
58                 'Options'       => array(
59                                 'Boolean' => array(
60                                                 'ExportToExcel' => false
61                                 )
62                 ),
63             'RequiredInput' => array(),
64             'OptionalInput' => array(
65                 'Grid'  => array(
66                     'NumberOfRecords' => 'Integer',
67                     'Page'            => 'Integer',
68                     'Filter'          => 'Array',
69                     'OrderBy'         => 'Array'
70                 )
71             ),
72             'Base'            => 'bid',
73             'NumberOfRecords' => 1000,
74         'Query'           => 'SELECT [SELECTION]
75                                               FROM \Auction\Entity\Bid bid
76                                               JOIN bid.company company
77                                               JOIN bid.profile profile
78                                                   LEFT JOIN bid.autoBid autoBid
79                                               [WHERE] [ORDER]',
80             'Selection'       => 'bid, autoBid, company, profile',
81             'Filter'          => array(),
82             'OrderBy'         => array('bid.amount' => 'DESC'),
83             'Fields'          => array(
84                                                 'id',
85                                                 'amount',
86                                                 'created' => 'DateTime',
87                                                 'status',
88                                                 'company' => array(
89                                                     'name'
90                                                 ),
91                                                 'profile' => array(
92                                                         'firstName',
93                                                         'familyName',
94                                                         'email'
95                                                 ),
96                                                 'autoBid' => array(
97                                                     'amount' => 'DateTime'
98                                                 )
99                                             )
100         );
101
102 }