Skip to content

Commit eb04e8b

Browse files
committed
adding ActiveRecord ORM
1 parent 50f7765 commit eb04e8b

35 files changed

+784
-30
lines changed

SOB/ActiveRecord/Model/Customer.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $customer_id MySQL type integer
7+
* @property ?string $company MySQL type varchar(50)
8+
* @property ?string $last_name MySQL type varchar(50)
9+
* @property ?string $first_name MySQL type varchar(50)
10+
* @property ?string $email_address MySQL type varchar(50)
11+
* @property ?string $job_title MySQL type varchar(50)
12+
* @property ?string $business_phone MySQL type varchar(25)
13+
* @property ?string $home_phone MySQL type varchar(25)
14+
* @property ?string $mobile_phone MySQL type varchar(25)
15+
* @property ?string $fax_number MySQL type varchar(25)
16+
* @property ?string $address MySQL type longtext
17+
* @property ?string $city MySQL type varchar(50)
18+
* @property ?string $state_province MySQL type varchar(50)
19+
* @property ?string $zip_postal_code MySQL type varchar(15)
20+
* @property ?string $country_region MySQL type varchar(50)
21+
* @property ?string $web_page MySQL type longtext
22+
* @property ?string $notes MySQL type longtext
23+
* @property ?string $attachments MySQL type longblob
24+
*/
25+
class Customer extends \ActiveRecord\Model
26+
{
27+
public static string $primary_key = 'customer_id';
28+
29+
public static string $table_name = 'customer';
30+
}

SOB/ActiveRecord/Model/DateRecord.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $dateRecordId MySQL type integer
7+
* @property string $dateRequired MySQL type date
8+
* @property ?string $dateDefaultNull MySQL type date
9+
* @property ?string $dateDefaultNullable MySQL type date
10+
* @property string $dateDefaultNotNull MySQL type date
11+
* @property ?string $timestampDefaultCurrentNullable MySQL type timestamp
12+
* @property string $timestampDefaultCurrentNotNull MySQL type timestamp
13+
*/
14+
class DateRecord extends \ActiveRecord\Model
15+
{
16+
public static string $primary_key = 'dateRecordId';
17+
18+
public static string $table_name = 'dateRecord';
19+
}

SOB/ActiveRecord/Model/Employee.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $employee_id MySQL type integer
7+
* @property ?string $company MySQL type varchar(50)
8+
* @property ?string $last_name MySQL type varchar(50)
9+
* @property ?string $first_name MySQL type varchar(50)
10+
* @property ?string $email_address MySQL type varchar(50)
11+
* @property ?string $job_title MySQL type varchar(50)
12+
* @property ?string $business_phone MySQL type varchar(25)
13+
* @property ?string $home_phone MySQL type varchar(25)
14+
* @property ?string $mobile_phone MySQL type varchar(25)
15+
* @property ?string $fax_number MySQL type varchar(25)
16+
* @property ?string $address MySQL type longtext
17+
* @property ?string $city MySQL type varchar(50)
18+
* @property ?string $state_province MySQL type varchar(50)
19+
* @property ?string $zip_postal_code MySQL type varchar(15)
20+
* @property ?string $country_region MySQL type varchar(50)
21+
* @property ?string $web_page MySQL type longtext
22+
* @property ?string $notes MySQL type longtext
23+
* @property ?string $attachments MySQL type longblob
24+
*/
25+
class Employee extends \ActiveRecord\Model
26+
{
27+
public static string $primary_key = 'employee_id';
28+
29+
public static string $table_name = 'employee';
30+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $employee_id MySQL type integer
7+
* @property int $privilege_id MySQL type integer
8+
*/
9+
class EmployeePrivilege extends \ActiveRecord\Model
10+
{
11+
public static string $primary_key = '~PRIMARY_KEY~';
12+
13+
public static string $table_name = 'employee_privilege';
14+
}

SOB/ActiveRecord/Model/Image.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $image_id MySQL type integer
7+
* @property ?int $imageable_id MySQL type integer
8+
* @property ?string $imageable_type MySQL type varchar(128)
9+
* @property string $path MySQL type varchar(128)
10+
*/
11+
class Image extends \ActiveRecord\Model
12+
{
13+
public static string $primary_key = 'image_id';
14+
15+
public static string $table_name = 'image';
16+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $inventory_transaction_id MySQL type integer
7+
* @property int $inventory_transaction_type_id MySQL type integer
8+
* @property string $transaction_created_date MySQL type datetime
9+
* @property string $transaction_modified_date MySQL type datetime
10+
* @property int $product_id MySQL type integer
11+
* @property int $quantity MySQL type integer
12+
* @property ?int $purchase_order_id MySQL type integer
13+
* @property ?int $order_id MySQL type integer
14+
* @property ?string $comments MySQL type varchar(255)
15+
*/
16+
class InventoryTransaction extends \ActiveRecord\Model
17+
{
18+
public static string $primary_key = 'inventory_transaction_id';
19+
20+
public static string $table_name = 'inventory_transaction';
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $inventory_transaction_type_id MySQL type integer
7+
* @property string $inventory_transaction_type_name MySQL type varchar(50)
8+
*/
9+
class InventoryTransactionType extends \ActiveRecord\Model
10+
{
11+
public static string $primary_key = 'inventory_transaction_type_id';
12+
13+
public static string $table_name = 'inventory_transaction_type';
14+
}

SOB/ActiveRecord/Model/Invoice.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $invoice_id MySQL type integer
7+
* @property ?int $order_id MySQL type integer
8+
* @property string $invoice_date MySQL type datetime
9+
* @property ?string $due_date MySQL type datetime
10+
* @property ?float $tax MySQL type decimal(19,4)
11+
* @property ?float $shipping MySQL type decimal(19,4)
12+
* @property ?float $amount_due MySQL type decimal(19,4)
13+
*/
14+
class Invoice extends \ActiveRecord\Model
15+
{
16+
public static string $primary_key = 'invoice_id';
17+
18+
public static string $table_name = 'invoice';
19+
}

SOB/ActiveRecord/Model/Migration.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $migrationId MySQL type int
7+
* @property ?string $ran MySQL type timestamp
8+
*/
9+
class Migration extends \ActiveRecord\Model
10+
{
11+
public static string $primary_key = 'migrationId';
12+
13+
public static string $table_name = 'migration';
14+
}

SOB/ActiveRecord/Model/Order.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace SOB\ActiveRecord\Model;
4+
5+
/**
6+
* @property int $order_id MySQL type integer
7+
* @property ?int $employee_id MySQL type integer
8+
* @property ?int $customer_id MySQL type integer
9+
* @property string $order_date MySQL type datetime
10+
* @property ?string $shipped_date MySQL type datetime
11+
* @property ?int $shipper_id MySQL type integer
12+
* @property ?string $ship_name MySQL type varchar(50)
13+
* @property ?string $ship_address MySQL type longtext
14+
* @property ?string $ship_city MySQL type varchar(50)
15+
* @property ?string $ship_state_province MySQL type varchar(50)
16+
* @property ?string $ship_zip_postal_code MySQL type varchar(50)
17+
* @property ?string $ship_country_region MySQL type varchar(50)
18+
* @property ?float $shipping_fee MySQL type decimal(19,4)
19+
* @property ?float $taxes MySQL type decimal(19,4)
20+
* @property ?string $payment_type MySQL type varchar(50)
21+
* @property ?string $paid_date MySQL type datetime
22+
* @property ?string $notes MySQL type longtext
23+
* @property ?float $tax_rate MySQL type double
24+
* @property ?int $order_tax_status_id MySQL type integer
25+
* @property ?int $order_status_id MySQL type integer
26+
*/
27+
class Order extends \ActiveRecord\Model
28+
{
29+
public static string $primary_key = 'order_id';
30+
31+
public static string $table_name = 'order';
32+
}

0 commit comments

Comments
 (0)