Skip to content

Instantly share code, notes, and snippets.

@styks1987
Last active March 15, 2016 18:10
Show Gist options
  • Save styks1987/453cde0ecb611b294602 to your computer and use it in GitHub Desktop.
Save styks1987/453cde0ecb611b294602 to your computer and use it in GitHub Desktop.
<?php
$invoice = $this->Invoices->newEntity([
'amount' => 100,
'description' => 'Simple little description of invoice',
'invoice_status_id' => 1,
'due_date' => new Time('2016-05-05')
]);
$invoice->user = $this->Invoices->Users->newEntity([
'first_name' => 'Bob',
'last_name' => "McBriddle",
'username' => 'brob',
'password' => 'becauseIhaveto'
]);
$invoice->user->detail = $this->Invoices->Users->Detail->newEntity([
'dba' => 'Coffee House Construction LLC'
]);
$invoice->listing = $this->Invoices->Listings->newEntity([
'title' => '2005 Volvo Materryder'
]);
$this->Invoices->save($invoice);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment