Skip to content

Commit 21d5c4b

Browse files
committed
Fix autogenerated @Property variable names for related records (remove trailing underscore)
1 parent cadcff8 commit 21d5c4b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Tests/Fixtures/Record/Definition/Order.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
* Autogenerated. Do not modify. Modify SQL table, then generate with \PHPFUI\ORM\Tool\Generate\CRUD class.
77
*
88
* @property ?int $customer_id MySQL type integer
9-
* @property \Tests\App\Record\Customer $customer_ related record
9+
* @property \Tests\App\Record\Customer $customer related record
1010
* @property ?int $employee_id MySQL type integer
11-
* @property \Tests\App\Record\Employee $employee_ related record
11+
* @property \Tests\App\Record\Employee $employee related record
1212
* @property ?string $notes MySQL type longtext
1313
* @property string $order_date MySQL type datetime
1414
* @property int $order_id MySQL type integer
15-
* @property \Tests\App\Record\Order $order_ related record
15+
* @property \Tests\App\Record\Order $order related record
1616
* @property ?int $order_status_id MySQL type integer
17-
* @property \Tests\App\Record\OrderStatus $order_status_ related record
17+
* @property \Tests\App\Record\OrderStatus $order_status related record
1818
* @property ?int $order_tax_status_id MySQL type integer
19-
* @property \Tests\App\Record\OrderTaxStatus $order_tax_status_ related record
19+
* @property \Tests\App\Record\OrderTaxStatus $order_tax_status related record
2020
* @property ?string $paid_date MySQL type datetime
2121
* @property ?string $payment_type MySQL type varchar(50)
2222
* @property ?string $ship_address MySQL type longtext
@@ -27,7 +27,7 @@
2727
* @property ?string $ship_zip_postal_code MySQL type varchar(50)
2828
* @property ?string $shipped_date MySQL type datetime
2929
* @property ?int $shipper_id MySQL type integer
30-
* @property \Tests\App\Record\Shipper $shipper_ related record
30+
* @property \Tests\App\Record\Shipper $shipper related record
3131
* @property ?float $shipping_fee MySQL type decimal(19,4)
3232
* @property ?float $tax_rate MySQL type double
3333
* @property ?float $taxes MySQL type decimal(19,4)

Tests/Fixtures/Record/Definition/OrderDetail.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
* @property ?string $date_allocated MySQL type datetime
99
* @property float $discount MySQL type double
1010
* @property ?int $inventory_transaction_id MySQL type integer
11-
* @property \Tests\App\Record\InventoryTransaction $inventory_transaction_ related record
11+
* @property \Tests\App\Record\InventoryTransaction $inventory_transaction related record
1212
* @property int $order_detail_id MySQL type integer
13-
* @property \Tests\Fixtures\Record\OrderDetail $order_detail_ related record
13+
* @property \Tests\Fixtures\Record\OrderDetail $order_detail related record
1414
* @property ?int $order_detail_status_id MySQL type integer
15-
* @property \Tests\Fixtures\Record\OrderDetailStatus $order_detail_status_ related record
15+
* @property \Tests\Fixtures\Record\OrderDetailStatus $order_detail_status related record
1616
* @property int $order_id MySQL type integer
17-
* @property \Tests\App\Record\Order $order_ related record
17+
* @property \Tests\App\Record\Order $order related record
1818
* @property ?int $product_id MySQL type integer
19-
* @property \Tests\App\Record\Product $product_ related record
19+
* @property \Tests\App\Record\Product $product related record
2020
* @property ?int $purchase_order_id MySQL type integer
21-
* @property \Tests\App\Record\PurchaseOrder $purchase_order_ related record
21+
* @property \Tests\App\Record\PurchaseOrder $purchase_order related record
2222
* @property float $quantity MySQL type decimal(18,4)
2323
* @property ?float $unit_price MySQL type decimal(19,4)
2424
*/

Tests/Fixtures/Record/Definition/Product.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @property ?int $minimum_reorder_quantity MySQL type integer
1414
* @property ?string $product_code MySQL type varchar(25)
1515
* @property int $product_id MySQL type integer
16-
* @property \Tests\App\Record\Product $product_ related record
16+
* @property \Tests\App\Record\Product $product related record
1717
* @property ?string $product_name MySQL type varchar(50)
1818
* @property ?string $quantity_per_unit MySQL type varchar(50)
1919
* @property ?int $reorder_level MySQL type integer

src/PHPFUI/ORM/Tool/Generate/CRUD.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private function getComment(\PHPFUI\ORM\Schema\Field $field, array &$commentedFi
217217

218218
if (\str_ends_with($fieldName, \PHPFUI\ORM::$idSuffix))
219219
{
220-
$var = \substr($fieldName, 0, \strlen($fieldName) - 2);
220+
$var = \substr($fieldName, 0, \strlen($fieldName) - \strlen(\PHPFUI\ORM::$idSuffix));
221221

222222
if (! isset($commentedFields[$var]))
223223
{

0 commit comments

Comments
 (0)