コード例 #1
0
ファイル: Contact.php プロジェクト: CreatrixeNew/carparking
 /**
  * Factory method to create a Contact object from an array
  * @param array $props - Associative array of initial properties to set
  * @return Contact
  */
 public static function create(array $props)
 {
     $contact = new Contact();
     $contact->id = parent::getValue($props, "id");
     $contact->status = parent::getValue($props, "status");
     $contact->first_name = parent::getValue($props, "first_name");
     $contact->middle_name = parent::getValue($props, "middle_name");
     $contact->last_name = parent::getValue($props, "last_name");
     $contact->confirmed = parent::getValue($props, "confirmed");
     $contact->source = parent::getValue($props, "source");
     foreach ($props['email_addresses'] as $email_address) {
         $contact->email_addresses[] = EmailAddress::create($email_address);
     }
     $contact->prefix_name = parent::getValue($props, "prefix_name");
     $contact->job_title = parent::getValue($props, "job_title");
     foreach ($props['addresses'] as $address) {
         $contact->addresses[] = Address::create($address);
     }
     foreach ($props['notes'] as $note) {
         $contact->notes[] = Note::create($note);
     }
     $contact->company_name = parent::getValue($props, "company_name");
     $contact->home_phone = parent::getValue($props, "home_phone");
     $contact->work_phone = parent::getValue($props, "work_phone");
     $contact->cell_phone = parent::getValue($props, "cell_phone");
     $contact->fax = parent::getValue($props, "fax");
     foreach ($props['custom_fields'] as $custom_field) {
         $contact->custom_fields[] = CustomField::create($custom_field);
     }
     foreach ($props['lists'] as $contact_list) {
         $contact->lists[] = ContactList::create($contact_list);
     }
     $contact->source_details = parent::getValue($props, "source_details");
     return $contact;
 }
コード例 #2
0
ファイル: itemfield.php プロジェクト: alencarmo/OCF
 function create()
 {
     // nem a kategoria specifikus, hanem az osszes kategoriara vonatkozoan kovetkezo columnIndexet allitjuk be.
     // Igy elerjuk, hogy a columnIndex biztos ne legyen meg foglalt egyetlen mas kategoriaban sem.
     if ($this->isCommon && !$this->isFixField()) {
         if ($this->commonFieldAlreadyExists()) {
             return;
         }
         $this->columnIndex = "col_" . CustomField::getNextColumnIndex();
     }
     parent::create();
     if (!Roll::isFormInvalid() && $this->isCommon && !$this->isFixField()) {
         $this->propagateCommonField();
     }
 }