<?php

namespace RxConnexionBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use RxConnexionBundle\RxConnexionBundle;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\SupplierRepository")
 * @ORM\Table(name="supplier")
 * @ORM\HasLifecycleCallbacks()
 */
 
class SupplierEntity
{
    const SUPPLIER_APPROVED = "Approved";
    const SUPPLIER_REJECTED = "Rejected";
    const SUPPLIER_PENDING = "Pending Approval";
    const NEW_SUPPLIER_FOR_ACCREDITATION = "New Supplier For Accreditation";

    /**
     * @ORM\Column(type="bigint")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
	protected $id;

    /**
     * @ORM\Column(name="code", type="string", nullable=true)
     */
	protected $code;
	
    /**
     * @ORM\Column(name="description", type="string")
     */
	protected $description;

    /**
     * @ORM\Column(name="street", type="string", nullable=true)
     */
    protected $street;

    /**
     * @ORM\Column(name="address", type="string", nullable=true)
     */
    protected $address;

    /**
     * @ORM\Column(name="mobile_no", type="string", nullable=true)
     */
    protected $mobileNo;

    /**
     * @ORM\Column(name="phone_no", type="string", nullable=true)
     */
    protected $phoneNo;

    /**
     * @ORM\Column(name="email", type="string", nullable=true)
     */
    protected $email;

    /**
     * @ORM\Column(name="fax", type="string", nullable=true)
     */
    protected $fax;

    /**
     * @ORM\Column(name="note", type="text", nullable=true)
     */
    protected $note;

    /**
     * @ORM\Column(name="contact_person", type="string", nullable=true)
     */
    protected $contactPerson;

    /**
     * @ORM\Column(name="payment_type", type="string", nullable=true)
     */
    protected $paymentType;

    /**
     * @ORM\Column(name="payment_term", type="integer", nullable=true)
     */
    protected $paymentTerm;

    /**
     * @ORM\Column(name="tin_no", type="integer", nullable=true)
     */
    protected $tinNo;

    /**
     * @ORM\Column(name="status", type="string", nullable=true)
     */
    protected $status;

    /**
     * @ORM\Column(name="created_by", type="string", length=50)
     */
	protected $createdBy;
	
    /**
     * @ORM\Column(name="created_at", type="datetime")
     */
	protected $createdAt;
	
    /**
     * @ORM\Column(name="updated_by", type="string", length=50)
     */
	protected $updatedBy;
	
       /**
     * @ORM\Column(name="updated_at", type="datetime")
     */
    protected $updatedAt;

    /**
     * @ORM\Column(name="is_deleted", type="boolean")
     */
    protected $isDeleted;

    /**
     * @ORM\Column(name="start_date", type="datetime", nullable=true)
     */
    protected $startDate;

    /**
     * @ORM\Column(name="end_date", type="datetime", nullable=true)
     */
    protected $endDate;

    /**
     * @ORM\ManyToOne(targetEntity="CityEntity", inversedBy="suppliers")
     * @ORM\JoinColumn(name="city_id", referencedColumnName="id")
     */
    protected $city;
//
//    /**
//     * @ORM\OneToOne(targetEntity="AccountUserEntity", mappedBy="supplier", cascade={"remove"})
//     */
//    protected $accountUser;


    /**
     * @ORM\OneToMany(targetEntity="CanvassItemSupplierEntity", mappedBy="supplier")
     */
    protected $canvassItemSuppliers;

    /**
     * @ORM\OneToMany(targetEntity="PurchaseOrderEntity", mappedBy="supplier")
     */
    protected $purchaseOrders;

//    /**
//     * @ORM\OneToMany(targetEntity="SlAccountLinkEntity", mappedBy="supplier")
//     */
//    protected $slAccountLinks;

    /**
     * @ORM\OneToMany(targetEntity="AddInventoryEntity", mappedBy="supplier")
     */
    protected $addInventories;
//
//    /**
//     * @ORM\OneToMany(targetEntity="AddFixedAssetEntity", mappedBy="supplier")
//     */
//    protected $addFixedAssets;
//
//    /**
//     * @ORM\OneToMany(targetEntity="WeighTranEntity", mappedBy="supplier")
//     */
//    protected $weighTrans;

    /**
     * @ORM\OneToMany(targetEntity="ItemSupplierEntity", mappedBy="supplier")
     */
    protected $itemSuppliers;

    /**
     * @ORM\OneToMany(targetEntity="ItemUnitMeasurementSupplierEntity", mappedBy="supplier")
     */
    protected $itemUnitMeasurementSuppliers;
//
//    /**
//     * @ORM\OneToMany(targetEntity="TransactionEntity", mappedBy="supplier")
//     */
//    protected $transactions;
//
//    /**
//     * @ORM\OneToMany(targetEntity="TransactionEntity", mappedBy="payee")
//     */
//    protected $payeeTransactions;
//
//    /**
//     * @ORM\OneToMany(targetEntity="TransactionJournalEntryEntity", mappedBy="supplier")
//     */
//    protected $transactionJournalEntries;

    /**
     * @ORM\OneToMany(targetEntity="SupplierFileEntity", mappedBy="supplier", cascade={"remove"})
     */
    protected $supplierFiles;

    /**
     * @ORM\OneToMany(targetEntity="SupplierStatusEntity", mappedBy="supplier", cascade={"remove"})
     */
    protected $supplierStatuses;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\ItemEntity", mappedBy="supplier", cascade={"remove"})
     */
    protected $items;
//
//    /**
//     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\UserPayTranEntity", mappedBy="supplier", cascade={"remove"})
//     */
//    protected $userPayTrans;
//
//    /**
//     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\PayrollDetailEntity", mappedBy="supplier", cascade={"remove"})
//     */
//    protected $payrollDetails;
  
    /** 
     * Set createdAt 
     * 
     * @ORM\PrePersist 
     */      
    public function setCreatedAtValue()  
    {
    	$this->createdBy = isSet($_COOKIE['username']) ? $_COOKIE['username'] : 'System';
        $this->createdAt = new \DateTime();
    	$this->updatedBy = isSet($_COOKIE['username']) ? $_COOKIE['username'] : 'System';
        $this->updatedAt = new \DateTime();
        $this->parseAddress();
        $this->status = $this::SUPPLIER_PENDING;
        $this->isDeleted = false;
    }
  
    /**
     * Set updatedAt
     * 
     * @ORM\PreUpdate 
     */  
    public function setUpdatedAtValue()  
    {  
    	$this->updatedBy = $_COOKIE['username'];
        $this->updatedAt = new \DateTime();
        $this->parseAddress();
    }

    private function parseAddress() {
        $this->address = $this->street . ($this->city ? ' ' . $this->city->getDescription() . ', ' . $this->city->getProvince()->getDescription() : '');
    }

    public function __construct($data=null)
    {
    	if(!is_null($data)) {
    		$this->id = $data->getId();
	    	$this->code = $data->getCode();
            $this->description = $data->getDescription();
            $this->street = $data->getStreet();
            $this->address = $data->getAddress();
            $this->mobileNo = $data->getMobileNo();
            $this->phoneNo = $data->getPhoneNo();
            $this->email = $data->getEmail();
            $this->contactPerson = $data->getContactPerson();
            $this->note = $data->getNote();
            $this->paymentType = $data->getPaymentType();
            $this->paymentTerm = $data->getPaymentTerm();
            $this->city = $data->getCity();
            $this->fax = $data->getFax();
            $this->tinNo = $data->getTinNo();
//            $this->accountUser = $data->getAccountUser();
            $this->startDate = $data->getStartDateAsString();
            $this->endDate = $data->getEndDateAsString();
            $this->status = $data->getStatus();
    	}

//        $this->canvassItemSuppliers = new ArrayCollection();
        $this->purchaseOrders = new ArrayCollection();
//        $this->slAccountLinks = new ArrayCollection();
        $this->addInventories = new ArrayCollection();
//        $this->weighTrans = new ArrayCollection();
        $this->itemSuppliers = new ArrayCollection();
//        $this->itemUnitMeasurementSuppliers =  new ArrayCollection();
//        $this->transactions = new ArrayCollection();
//        $this->transactionJournalEntries = new ArrayCollection();
//        $this->payeeTransactions = new ArrayCollection();
        $this->supplierFiles = new ArrayCollection();
        $this->supplierStatuses = new ArrayCollection();
//        $this->userPayTrans = new ArrayCollection();
//        $this->payrollDetails = new ArrayCollection();
    }

	/*--------------------------------------------------------------------------------------------------------*/
	/*					User Defined Setters and Getters													  */
	/*--------------------------------------------------------------------------------------------------------*/

    /**
     * Get itemSupplierLastOrder
     *
     * @return array()
     */
    public function getItemSupplierLastOrder($itemId) {
        $itemSupplierLastOrder = array();
        $canvassItemSuppliersCount = count($this->canvassItemSuppliers);
        foreach ($this->canvassItemSuppliers as $key =>  $canvassItemSupplier){
            if($key == ($canvassItemSuppliersCount - 1)){
                if(($canvassItemSupplier->getCanvassItem()->getMaterialRequisitionItem()->getItem()->getId() == $itemId) && $canvassItemSupplier->getIsSelected()){

                    $dttst = new DateTimeToStringTransformer();
                    $itemSupplierLastOrder['date'] =  date('m/d/Y', strtotime($dttst->transform($canvassItemSupplier->getCreatedAt())));
                    $itemSupplierLastOrder['price'] = $canvassItemSupplier->getPrice();
                }
            }
        }

        return $itemSupplierLastOrder;
    }

	/**
     * Get itemSupplier
     *
     * @return RxConnexionBundle/Entity/ItemSupplierEntity
     */
    public function getItemSupplier($itemId) {
        $itemSupplier_obj = null;

        foreach ($this->itemSuppliers as $itemSupplier){
            if($itemSupplier->getItem()->getId() == $itemId){
                $itemSupplier_obj = $itemSupplier;
            }
        }

        return $itemSupplier_obj;
    }

    /**
     * Get startDateAsString
     *
     * @return string
     */
    public function getStartDateAsString() {

        $dttst = new DateTimeToStringTransformer();
        return !empty($this->startDate) ? date('m/d/Y', strtotime($dttst->transform($this->startDate))) : '';
    }
    /**
     * Get endDateAsString
     *
     * @return string
     */
    public function getEndDateAsString() {

        $dttst = new DateTimeToStringTransformer();
        return !empty($this->endDate) ? date('m/d/Y', strtotime($dttst->transform($this->endDate))) : '';
    }


    /**
     * Get idEncoded
     *
     * @return string
     */
    public function getIdEncoded() {

        return base64_encode($this->id);
    }

    /**
     * Get codeAndDescription
     *
     * @return string
     */
    public function getCodeAndDescription() {

        return $this->code . ' - ' . $this->description;
    }
    
	/*--------------------------------------------------------------------------------------------------------*/
	/*					Setters and Getters																	  */
	/*--------------------------------------------------------------------------------------------------------*/


    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set code
     *
     * @param string $code
     *
     * @return SupplierEntity
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

    /**
     * Get code
     *
     * @return string
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * Set description
     *
     * @param string $description
     *
     * @return SupplierEntity
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set street
     *
     * @param string $street
     *
     * @return SupplierEntity
     */
    public function setStreet($street)
    {
        $this->street = $street;

        return $this;
    }

    /**
     * Get street
     *
     * @return string
     */
    public function getStreet()
    {
        return $this->street;
    }

    /**
     * Set address
     *
     * @param string $address
     *
     * @return SupplierEntity
     */
    public function setAddress($address)
    {
        $this->address = $address;

        return $this;
    }

    /**
     * Get address
     *
     * @return string
     */
    public function getAddress()
    {
        return $this->address;
    }

    /**
     * Set mobileNo
     *
     * @param string $mobileNo
     *
     * @return SupplierEntity
     */
    public function setMobileNo($mobileNo)
    {
        $this->mobileNo = $mobileNo;

        return $this;
    }

    /**
     * Get mobileNo
     *
     * @return string
     */
    public function getMobileNo()
    {
        return $this->mobileNo;
    }

    /**
     * Set phoneNo
     *
     * @param string $phoneNo
     *
     * @return SupplierEntity
     */
    public function setPhoneNo($phoneNo)
    {
        $this->phoneNo = $phoneNo;

        return $this;
    }

    /**
     * Get phoneNo
     *
     * @return string
     */
    public function getPhoneNo()
    {
        return $this->phoneNo;
    }

    /**
     * Set email
     *
     * @param string $email
     *
     * @return SupplierEntity
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set fax
     *
     * @param string $fax
     *
     * @return SupplierEntity
     */
    public function setFax($fax)
    {
        $this->fax = $fax;

        return $this;
    }

    /**
     * Get fax
     *
     * @return string
     */
    public function getFax()
    {
        return $this->fax;
    }

    /**
     * Set note
     *
     * @param string $note
     *
     * @return SupplierEntity
     */
    public function setNote($note)
    {
        $this->note = $note;

        return $this;
    }

    /**
     * Get note
     *
     * @return string
     */
    public function getNote()
    {
        return $this->note;
    }

    /**
     * Set contactPerson
     *
     * @param string $contactPerson
     *
     * @return SupplierEntity
     */
    public function setContactPerson($contactPerson)
    {
        $this->contactPerson = $contactPerson;

        return $this;
    }

    /**
     * Get contactPerson
     *
     * @return string
     */
    public function getContactPerson()
    {
        return $this->contactPerson;
    }

    /**
     * Set paymentType
     *
     * @param string $paymentType
     *
     * @return SupplierEntity
     */
    public function setPaymentType($paymentType)
    {
        $this->paymentType = $paymentType;

        return $this;
    }

    /**
     * Get paymentType
     *
     * @return string
     */
    public function getPaymentType()
    {
        return $this->paymentType;
    }

    /**
     * Set paymentTerm
     *
     * @param integer $paymentTerm
     *
     * @return SupplierEntity
     */
    public function setPaymentTerm($paymentTerm)
    {
        $this->paymentTerm = $paymentTerm;

        return $this;
    }

    /**
     * Get paymentTerm
     *
     * @return integer
     */
    public function getPaymentTerm()
    {
        return $this->paymentTerm;
    }

    /**
     * Set tinNo
     *
     * @param integer $tinNo
     *
     * @return SupplierEntity
     */
    public function setTinNo($tinNo)
    {
        $this->tinNo = $tinNo;

        return $this;
    }

    /**
     * Get tinNo
     *
     * @return integer
     */
    public function getTinNo()
    {
        return $this->tinNo;
    }

    /**
     * Set status
     *
     * @param string $status
     *
     * @return SupplierEntity
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

    /**
     * Get status
     *
     * @return string
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return SupplierEntity
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Get createdBy
     *
     * @return string
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     *
     * @return SupplierEntity
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedBy
     *
     * @param string $updatedBy
     *
     * @return SupplierEntity
     */
    public function setUpdatedBy($updatedBy)
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

    /**
     * Get updatedBy
     *
     * @return string
     */
    public function getUpdatedBy()
    {
        return $this->updatedBy;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     *
     * @return SupplierEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Set startDate
     *
     * @param \DateTime $startDate
     *
     * @return SupplierEntity
     */
    public function setStartDate($startDate)
    {
        $this->startDate = empty($startDate) ? NULL : new \DateTime($startDate);

        return $this;
    }

    /**
     * Get startDate
     *
     * @return \DateTime
     */
    public function getStartDate()
    {
        return $this->startDate;
    }

    /**
     * Set endDate
     *
     * @param \DateTime $endDate
     *
     * @return SupplierEntity
     */
    public function setEndDate($endDate)
    {
        $this->endDate = empty($endDate) ? NULL : new \DateTime($endDate);

        return $this;
    }

    /**
     * Get endDate
     *
     * @return \DateTime
     */
    public function getEndDate()
    {
        return $this->endDate;
    }

    /**
     * Set city
     *
     * @param \RxConnexionBundle\Entity\CityEntity $city
     *
     * @return SupplierEntity
     */
    public function setCity(\RxConnexionBundle\Entity\CityEntity $city = null)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return \RxConnexionBundle\Entity\CityEntity
     */
    public function getCity()
    {
        return $this->city;
    }

//    /**
//     * Set accountUser
//     *
//     * @param \RxConnexionBundle\Entity\AccountUserEntity $accountUser
//     *
//     * @return SupplierEntity
//     */
//    public function setAccountUser(\RxConnexionBundle\Entity\AccountUserEntity $accountUser = null)
//    {
//        $this->accountUser = $accountUser;
//
//        return $this;
//    }
//
//    /**
//     * Get accountUser
//     *
//     * @return \RxConnexionBundle\Entity\AccountUserEntity
//     */
//    public function getAccountUser()
//    {
//        return $this->accountUser;
//    }

    /**
     * Add addInventory
     *
     * @param \RxConnexionBundle\Entity\AddInventoryEntity $addInventory
     *
     * @return SupplierEntity
     */
    public function addAddInventory(\RxConnexionBundle\Entity\AddInventoryEntity $addInventory)
    {
        $this->addInventories[] = $addInventory;

        return $this;
    }

    /**
     * Remove addInventory
     *
     * @param \RxConnexionBundle\Entity\AddInventoryEntity $addInventory
     */
    public function removeAddInventory(\RxConnexionBundle\Entity\AddInventoryEntity $addInventory)
    {
        $this->addInventories->removeElement($addInventory);
    }

    /**
     * Get addInventories
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAddInventories()
    {
        return $this->addInventories;
    }

    /**
     * Add itemSupplier
     *
     * @param \RxConnexionBundle\Entity\ItemSupplierEntity $itemSupplier
     *
     * @return SupplierEntity
     */
    public function addItemSupplier(\RxConnexionBundle\Entity\ItemSupplierEntity $itemSupplier)
    {
        $this->itemSuppliers[] = $itemSupplier;

        return $this;
    }

    /**
     * Remove itemSupplier
     *
     * @param \RxConnexionBundle\Entity\ItemSupplierEntity $itemSupplier
     */
    public function removeItemSupplier(\RxConnexionBundle\Entity\ItemSupplierEntity $itemSupplier)
    {
        $this->itemSuppliers->removeElement($itemSupplier);
    }

    /**
     * Get itemSuppliers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getItemSuppliers()
    {
        return $this->itemSuppliers;
    }

    /**
     * Add supplierFile
     *
     * @param \RxConnexionBundle\Entity\SupplierFileEntity $supplierFile
     *
     * @return SupplierEntity
     */
    public function addSupplierFile(\RxConnexionBundle\Entity\SupplierFileEntity $supplierFile)
    {
        $this->supplierFiles[] = $supplierFile;

        return $this;
    }

    /**
     * Remove supplierFile
     *
     * @param \RxConnexionBundle\Entity\SupplierFileEntity $supplierFile
     */
    public function removeSupplierFile(\RxConnexionBundle\Entity\SupplierFileEntity $supplierFile)
    {
        $this->supplierFiles->removeElement($supplierFile);
    }

    /**
     * Get supplierFiles
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getSupplierFiles()
    {
        return $this->supplierFiles;
    }

    /**
     * Add supplierStatus
     *
     * @param \RxConnexionBundle\Entity\SupplierStatusEntity $supplierStatus
     *
     * @return SupplierEntity
     */
    public function addSupplierStatus(\RxConnexionBundle\Entity\SupplierStatusEntity $supplierStatus)
    {
        $this->supplierStatuses[] = $supplierStatus;

        return $this;
    }

    /**
     * Remove supplierStatus
     *
     * @param \RxConnexionBundle\Entity\SupplierStatusEntity $supplierStatus
     */
    public function removeSupplierStatus(\RxConnexionBundle\Entity\SupplierStatusEntity $supplierStatus)
    {
        $this->supplierStatuses->removeElement($supplierStatus);
    }

    /**
     * Get supplierStatuses
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getSupplierStatuses()
    {
        return $this->supplierStatuses;
    }

    /**
     * Add itemUnitMeasurementSupplier
     *
     * @param \RxConnexionBundle\Entity\ItemUnitMeasurementSupplierEntity $itemUnitMeasurementSupplier
     *
     * @return SupplierEntity
     */
    public function addItemUnitMeasurementSupplier(\RxConnexionBundle\Entity\ItemUnitMeasurementSupplierEntity $itemUnitMeasurementSupplier)
    {
        $this->itemUnitMeasurementSuppliers[] = $itemUnitMeasurementSupplier;

        return $this;
    }

    /**
     * Remove itemUnitMeasurementSupplier
     *
     * @param \RxConnexionBundle\Entity\ItemUnitMeasurementSupplierEntity $itemUnitMeasurementSupplier
     */
    public function removeItemUnitMeasurementSupplier(\RxConnexionBundle\Entity\ItemUnitMeasurementSupplierEntity $itemUnitMeasurementSupplier)
    {
        $this->itemUnitMeasurementSuppliers->removeElement($itemUnitMeasurementSupplier);
    }

    /**
     * Get itemUnitMeasurementSuppliers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getItemUnitMeasurementSuppliers()
    {
        return $this->itemUnitMeasurementSuppliers;
    }

    /**
     * Set isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return SupplierEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return boolean
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Add canvassItemSupplier
     *
     * @param \RxConnexionBundle\Entity\CanvassItemSupplierEntity $canvassItemSupplier
     *
     * @return SupplierEntity
     */
    public function addCanvassItemSupplier(\RxConnexionBundle\Entity\CanvassItemSupplierEntity $canvassItemSupplier)
    {
        $this->canvassItemSuppliers[] = $canvassItemSupplier;

        return $this;
    }

    /**
     * Remove canvassItemSupplier
     *
     * @param \RxConnexionBundle\Entity\CanvassItemSupplierEntity $canvassItemSupplier
     */
    public function removeCanvassItemSupplier(\RxConnexionBundle\Entity\CanvassItemSupplierEntity $canvassItemSupplier)
    {
        $this->canvassItemSuppliers->removeElement($canvassItemSupplier);
    }

    /**
     * Get canvassItemSuppliers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCanvassItemSuppliers()
    {
        return $this->canvassItemSuppliers;
    }

    /**
     * Add purchaseOrder
     *
     * @param \RxConnexionBundle\Entity\PurchaseOrderEntity $purchaseOrder
     *
     * @return SupplierEntity
     */
    public function addPurchaseOrder(\RxConnexionBundle\Entity\PurchaseOrderEntity $purchaseOrder)
    {
        $this->purchaseOrders[] = $purchaseOrder;

        return $this;
    }

    /**
     * Remove purchaseOrder
     *
     * @param \RxConnexionBundle\Entity\PurchaseOrderEntity $purchaseOrder
     */
    public function removePurchaseOrder(\RxConnexionBundle\Entity\PurchaseOrderEntity $purchaseOrder)
    {
        $this->purchaseOrders->removeElement($purchaseOrder);
    }

    /**
     * Get purchaseOrders
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPurchaseOrders()
    {
        return $this->purchaseOrders;
    }

    /**
     * Add item
     *
     * @param \RxConnexionBundle\Entity\ItemEntity $item
     *
     * @return SupplierEntity
     */
    public function addItem(\RxConnexionBundle\Entity\ItemEntity $item)
    {
        $this->items[] = $item;

        return $this;
    }

    /**
     * Remove item
     *
     * @param \RxConnexionBundle\Entity\ItemEntity $item
     */
    public function removeItem(\RxConnexionBundle\Entity\ItemEntity $item)
    {
        $this->items->removeElement($item);
    }

    /**
     * Get items
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getItems()
    {
        return $this->items;
    }
}
