Skip to content

Commit

Permalink
Fix for issue #11 - Corrected types for getters and setters of array …
Browse files Browse the repository at this point in the history
…properties
  • Loading branch information
calcinai committed Mar 13, 2015
1 parent 8601370 commit 922c011
Show file tree
Hide file tree
Showing 52 changed files with 280 additions and 279 deletions.
5 changes: 3 additions & 2 deletions generator/templates/model.twig
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ class {{ model.ClassName }} extends Remote\Object {
{# getters and setters #}
{% for property in model.properties %}
/**
* @return {{ property.PHPType }}
* @return {{ property.PHPType }}{% if property.isArray %}[]{% endif %}

*/
public function get{{ property.Name }}(){
return $this->_data['{{ property.Name }}'];
}

{% if property.isReadOnly == false %}
/**
* @param {{ property.PHPType }}{% if property.isArray %}[]{% endif %} $value
* @param {{ property.PHPType }} $value
* @return {{ model.ClassName }}
*/
public function {% if property.isArray %}add{% else %}set{% endif %}{{ property.NameSingular }}({% if property.isHintable %}{{ property.PHPType }} {% endif %}$value){
Expand Down
8 changes: 4 additions & 4 deletions src/XeroPHP/Models/Accounting/BankTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ public function setContact(Contact $value){
}

/**
* @return LineItem
* @return LineItem[]
*/
public function getLineitems(){
return $this->_data['Lineitems'];
}

/**
* @param LineItem[] $value
* @param LineItem $value
* @return BankTransaction
*/
public function addLineitem(LineItem $value){
Expand Down Expand Up @@ -407,14 +407,14 @@ public function setStatus($value){
}

/**
* @return float
* @return float[]
*/
public function getLineAmountTypes(){
return $this->_data['LineAmountTypes'];
}

/**
* @param float[] $value
* @param float $value
* @return BankTransaction
*/
public function addLineAmountType($value){
Expand Down
40 changes: 20 additions & 20 deletions src/XeroPHP/Models/Accounting/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,14 @@ public function setSkypeUserName($value){
}

/**
* @return ContactPerson
* @return ContactPerson[]
*/
public function getContactPersons(){
return $this->_data['ContactPersons'];
}

/**
* @param ContactPerson[] $value
* @param ContactPerson $value
* @return Contact
*/
public function addContactPerson(ContactPerson $value){
Expand All @@ -491,14 +491,14 @@ public function addContactPerson(ContactPerson $value){
}

/**
* @return string
* @return string[]
*/
public function getBankAccountDetails(){
return $this->_data['BankAccountDetails'];
}

/**
* @param string[] $value
* @param string $value
* @return Contact
*/
public function addBankAccountDetail($value){
Expand Down Expand Up @@ -559,14 +559,14 @@ public function setAccountsPayableTaxType($value){
}

/**
* @return Address
* @return Address[]
*/
public function getAddresses(){
return $this->_data['Addresses'];
}

/**
* @param Address[] $value
* @param Address $value
* @return Contact
*/
public function addAddress(Address $value){
Expand All @@ -576,14 +576,14 @@ public function addAddress(Address $value){
}

/**
* @return Phone
* @return Phone[]
*/
public function getPhones(){
return $this->_data['Phones'];
}

/**
* @param Phone[] $value
* @param Phone $value
* @return Contact
*/
public function addPhone(Phone $value){
Expand Down Expand Up @@ -712,14 +712,14 @@ public function setPurchasesDefaultAccountCode($value){
}

/**
* @return TrackingCategory
* @return TrackingCategory[]
*/
public function getSalesTrackingCategories(){
return $this->_data['SalesTrackingCategories'];
}

/**
* @param TrackingCategory[] $value
* @param TrackingCategory $value
* @return Contact
*/
public function addSalesTrackingCategory(TrackingCategory $value){
Expand All @@ -729,14 +729,14 @@ public function addSalesTrackingCategory(TrackingCategory $value){
}

/**
* @return TrackingCategory
* @return TrackingCategory[]
*/
public function getPurchasesTrackingCategories(){
return $this->_data['PurchasesTrackingCategories'];
}

/**
* @param TrackingCategory[] $value
* @param TrackingCategory $value
* @return Contact
*/
public function addPurchasesTrackingCategory(TrackingCategory $value){
Expand All @@ -746,14 +746,14 @@ public function addPurchasesTrackingCategory(TrackingCategory $value){
}

/**
* @return ContactGroup
* @return ContactGroup[]
*/
public function getContactGroups(){
return $this->_data['ContactGroups'];
}

/**
* @param ContactGroup[] $value
* @param ContactGroup $value
* @return Contact
*/
public function addContactGroup(ContactGroup $value){
Expand Down Expand Up @@ -797,14 +797,14 @@ public function setBrandingTheme(BrandingTheme $value){
}

/**
* @return string
* @return string[]
*/
public function getBatchPayments(){
return $this->_data['BatchPayments'];
}

/**
* @param string[] $value
* @param string $value
* @return Contact
*/
public function addBatchPayment($value){
Expand All @@ -831,14 +831,14 @@ public function setDiscount($value){
}

/**
* @return string
* @return string[]
*/
public function getBalances(){
return $this->_data['Balances'];
}

/**
* @param string[] $value
* @param string $value
* @return Contact
*/
public function addBalance($value){
Expand All @@ -848,14 +848,14 @@ public function addBalance($value){
}

/**
* @return PaymentTerm
* @return PaymentTerm[]
*/
public function getPaymentTerms(){
return $this->_data['PaymentTerms'];
}

/**
* @param PaymentTerm[] $value
* @param PaymentTerm $value
* @return Contact
*/
public function addPaymentTerm(PaymentTerm $value){
Expand Down
4 changes: 2 additions & 2 deletions src/XeroPHP/Models/Accounting/ContactGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ public function setContactGroupID($value){
}

/**
* @return Contact
* @return Contact[]
*/
public function getContacts(){
return $this->_data['Contacts'];
}

/**
* @param Contact[] $value
* @param Contact $value
* @return ContactGroup
*/
public function addContact(Contact $value){
Expand Down
12 changes: 6 additions & 6 deletions src/XeroPHP/Models/Accounting/CreditNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ public function setStatus($value){
}

/**
* @return float
* @return float[]
*/
public function getLineAmountTypes(){
return $this->_data['LineAmountTypes'];
}

/**
* @param float[] $value
* @param float $value
* @return CreditNote
*/
public function addLineAmountType($value){
Expand All @@ -331,14 +331,14 @@ public function addLineAmountType($value){
}

/**
* @return LineItem
* @return LineItem[]
*/
public function getLineItems(){
return $this->_data['LineItems'];
}

/**
* @param LineItem[] $value
* @param LineItem $value
* @return CreditNote
*/
public function addLineItem(LineItem $value){
Expand Down Expand Up @@ -535,14 +535,14 @@ public function setRemainingCredit($value){
}

/**
* @return Allocation
* @return Allocation[]
*/
public function getAllocations(){
return $this->_data['Allocations'];
}

/**
* @param Allocation[] $value
* @param Allocation $value
* @return CreditNote
*/
public function addAllocation(Allocation $value){
Expand Down
4 changes: 2 additions & 2 deletions src/XeroPHP/Models/Accounting/ExpenseClaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ public function setUser(User $value){
}

/**
* @return Receipt
* @return Receipt[]
*/
public function getReceipts(){
return $this->_data['Receipts'];
}

/**
* @param Receipt[] $value
* @param Receipt $value
* @return ExpenseClaim
*/
public function addReceipt(Receipt $value){
Expand Down
16 changes: 8 additions & 8 deletions src/XeroPHP/Models/Accounting/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ public function setContact(Contact $value){
}

/**
* @return LineItem
* @return LineItem[]
*/
public function getLineItems(){
return $this->_data['LineItems'];
}

/**
* @param LineItem[] $value
* @param LineItem $value
* @return Invoice
*/
public function addLineItem(LineItem $value){
Expand Down Expand Up @@ -398,14 +398,14 @@ public function setDueDate(\DateTime $value){
}

/**
* @return float
* @return float[]
*/
public function getLineAmountTypes(){
return $this->_data['LineAmountTypes'];
}

/**
* @param float[] $value
* @param float $value
* @return Invoice
*/
public function addLineAmountType($value){
Expand Down Expand Up @@ -633,23 +633,23 @@ public function getHasAttachments(){


/**
* @return Payment
* @return Payment[]
*/
public function getPayments(){
return $this->_data['Payments'];
}


/**
* @return Prepayment
* @return Prepayment[]
*/
public function getPrepayments(){
return $this->_data['Prepayments'];
}


/**
* @return Overpayment
* @return Overpayment[]
*/
public function getOverpayments(){
return $this->_data['Overpayments'];
Expand Down Expand Up @@ -697,7 +697,7 @@ public function getUpdatedDateUTC(){


/**
* @return CreditNote
* @return CreditNote[]
*/
public function getCreditNotes(){
return $this->_data['CreditNotes'];
Expand Down
Loading

1 comment on commit 922c011

@paulschwarz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brilliant

Please sign in to comment.