Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ShipmentHandlingUnitsTable extends Table
{....
public function initialize(array $config)
{
...
$this->belongsToMany('OrderLines', [
'foreignKey' => 'shipment_handling_unit_id',
'targetForeignKey' => 'order_line_id',
'joinTable' => 'order_lines_shipment_handling_units'
]);
}
-------------
class ShipmentsTable extends Table
{
...
public function initialize(array $config)
{
...
$this->hasMany('ShipmentHandlingUnits', [
'foreignKey' => 'shipment_id'
]);
}
-------
$shipment = $this->Shipments->patchEntity($shipment, $this->request->getData(),['associated'=>['ShipmentHandlingUnits.OrderLines']]);
----
echo $this->Form->input("shipment_handling_units[0].order_lines[$i]._joinData.order_line_id",['type'=>'hidden','value'=>$orderLine->id]);
echo $this->Form->input("shipment_handling_units[0].order_lines[$i]._joinData.qty",['label'=>'']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.