/** * (non-PHPdoc) * Overwrite the set function seeing forms might have field entities * attached to them. This require that form data be stripped and entity created as normal. * Fields are created as seperate entities and stored within objFormFieldEntities. * @see \FrontCore\Adapters\AbstractEntityAdapter::set() */ public function set($key, $value = NULL) { //is data being received from a form? if (is_array($key) && isset($key["submit"])) { parent::set($key); } //end if if ((is_object($key) || is_array($key)) && $value === NULL && (isset($key->form) || is_array($key) && isset($key["form"]))) { //convert array to object where required if (is_array($key)) { $key = (object) $key; } //end if //set field data first //check for any fields if ($key->fields !== NULL) { foreach ($key->fields as $field) { //create entitity and save attach to form $entity_field = $this->getFormFieldEntityObjectInstance(); //set data $entity_field->set($field); $arr[] = $entity_field; } //end foreach //assign data to form entitiy $this->objFormFieldEntities = (object) $arr; //remove field data from data unset($key->fields); } //end if //strip form data if (is_array($key->form) || is_object($key->form)) { parent::set($key->form); } else { parent::set($key); } //end if } //end if }
public function setSecure($key, $value) { $value = $this->objCrypto->sha1EncryptDecryptValue("encrypt", $value, array()); parent::set($key . "_secure", $value); }