Skip to content

Instantly share code, notes, and snippets.

@kailasnarendran
Created October 19, 2019 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kailasnarendran/ef0bb5536cb9d13a97e5ac3ad4d82252 to your computer and use it in GitHub Desktop.
Save kailasnarendran/ef0bb5536cb9d13a97e5ac3ad4d82252 to your computer and use it in GitHub Desktop.
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