Skip to content

Instantly share code, notes, and snippets.

@midorikocak
Created November 30, 2014 17:25
Show Gist options
  • Save midorikocak/c98fe9df8375bfd96449 to your computer and use it in GitHub Desktop.
Save midorikocak/c98fe9df8375bfd96449 to your computer and use it in GitHub Desktop.
saving associated data in cakephp 3
<?=$this->element('business_actions')?>
<div class="businesses form large-10 medium-9 columns">
<?= $this->Form->create($entity) ?>
<fieldset>
<legend><?= __('Add Business') ?></legend>
<?php
echo $this->Form->input('name');
echo $this->Form->input('url');
echo $this->Form->input('description');
echo $this->Form->input('businesses.0.businesstype_id', ['options' => $businesstypes]);
echo $this->Form->input('emails.0.email');
echo $this->Form->input('telephones.0.telephonetype_id', ['options' => $telephonetypes]);
echo $this->Form->input('telephones.0.telephone');
echo $this->Form->input('addresses.0.streetAddress');
echo $this->Form->input('addresses.0.addressLocality');
echo $this->Form->input('addresses.0.postalCode');
echo $this->Form->input('addresses.0.addressCountry');
echo $this->Form->input('addresses.0.description',['label'=>__('Address Description')]);
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment