Initialize data

@param  string | array $property
@return Model
498886
public function initialize($property = null) {
		// By method
		$initMethod = lcfirst($property) . self::INIT_POSTFIX;
		
		if (method_exists($this, $initMethod)) {
			$this->_data[$property]        = $this->$initMethod();
			$this->_initialized[$property] = true;
			
			return $this;
		}
		
		// By source definition
		if ($this->_sources === null) {
			return $this;
		}
		
		if ($property === null) {
			$properties = array_keys($this->_sources);
		}
		
		foreach ((array) $properties as $property) {
			if (isset($this->_initialized[$property])) {
				continue;
			}

			if (isset($this->_sources[$property])) {
				$this->_initialize($property, $this->_sources[$property]);
				$this->_initialized[$property] = true;
			}
		}
		
		return $this;
	}
411674
final private function prepareData($properties) {
	
		// trigger before preparing data
		$this->beforePrepareData();
		
		// properly cast a property of this object and return it
		$cast = function($prop) {
			
			$field = static::getMappedField($prop);

			switch ($this->getPropertyType($prop)) {
				
				// integer or bool will cast to integer
				case 'int':
				case 'bool':
					if (is_null($this->$prop) and static::isNullable($field)) {
						$ret = NULL;
					} else {
						$ret = (int)$this->$prop;
					}
					break;
				
				// should be DateTime, maybe null
				case 'DateTime':
					if (is_a($this->$prop, 'DateTime')) {
						$dt = clone($this->$prop);
						$dt->setTimezone(new \DateTimeZone(BASE_TIMEZONE));
						$ret = $dt->format('Y-m-d H:i:s');
					} else if (static::isNullable($field)) {
						$ret = NULL;
					} else {
						$field = static::getColumnType($field);
						$ret = 'date' == $field->type ? '0000-00-00' :'0000-00-00 00:00:00';
					}
					break;
						
				// join array strings in CSV format 
				case 'csv':
					$ret = implode(',', array_filter((array)$this->$prop));
					break;
					
				case 'float':
					if (is_null($this->$prop) and static::isNullable($field)) {
						$ret = NULL;
					} else {
						$curr = setlocale(LC_NUMERIC, 0);
						setlocale(LC_NUMERIC, 'en_US');
						$ret = (string)$this->$prop;
						setlocale(LC_NUMERIC, $curr);
					}
					break;

				// assign with no convertion
				default:
					if ((is_null($this->$prop) or (''==$this->$prop and !static::isEmptiable($field)))
							and static::isNullable($field)) {
						$ret = NULL;
					} else {
						$ret = $this->$prop;
					}
					break;
					
			}
			
			return $ret;
			
		};
		
		// force to array
		$properties	= (array)$properties;

		$class = get_called_class();
		$binds = $class::getBinds();
		
		// create the return object
		$dbObj = new \stdClass();
		
		foreach ($properties as $prop) {
			if (array_key_exists($prop, $binds)) {
				$dbObj->{$binds[$prop]} = $cast($prop);
			}
		}
		
		// trigger after prepared data
		$this->afterPrepareData($dbObj);
			
		return $dbObj;
	
	}
151906
public function set($property, $value = null)
    {
        if (is_string($property) && $value != '') {
            $property = [$property => $value];
        }

        foreach ($property as $name => $value) {
            $this->properties[$name] = $value;
        }

        return $this;
    }
1176206
public function setProperty($property, $value)
    {
        if (property_exists($this, $property) && $property !== 'form') {
            $this->$property = $value;
        }
        return $this;
    }
206969
public function &__get($property)
	{
		$value = null;
		
		if(!empty($property))
		{
			$call = "getter_".$property;
			
			if(method_exists($this, $call))
				$value = $this->{$call}();
			
			/*
				elseif($this instanceof ArrayAccess)
					$value = $this->offsetGet($property);
			*/
		}
		
		return $value;
	}
664278
public function initAnnotation(array $properties) {
		if (isset ( $properties [0] )) {
			$this->type = $properties [0];
			unset ( $properties [0] );
			if (isset ( $properties [1] )) {
				if (! is_array ( $properties [1] )) {
					$this->constraints = [ "ref" => $properties [1] ];
				} else {
					$this->constraints = $properties [1];
				}
				unset ( $properties [1] );
			}
		} else {
			throw new \Exception ( 'Validator annotation must have a type' );
		}
		parent::initAnnotation ( $properties );
		if (! isset ( ValidatorsManager::$validatorTypes [$this->type] )) {
			throw new \Exception ( 'This type of annotation does not exists : ' . $this->type );
		}
	}
3717
protected function initializeProperties($properties = null)
    {
        $this->getPropertiesInfo();

        // Initialize the properties that were defined using the Initialize / InitializeObject annotations
        $initializeValueValidationEnabled = Configuration::isInitializeValuesValidationEnabled();
        foreach ($this->_initialPropertiesValues as $propertyName => $initialization) {
            $value = null;
            switch ($initialization['type']) {
                case 'initialize':
                    $value = $initialization['value'];
                    break;
                default:
                    $className = $initialization['value'];
                    $value = new $className();
                    break;
            }

            if ($initializeValueValidationEnabled) {
                $this->assertPropertyValue($propertyName, $value);
            }

            $this->$propertyName = $value;
            $this->updateInitializedPropertyValue($propertyName, $value);
        }

        // Initialize the propeties using given arguments
        if ($this->_initializationNeededArguments !== null && $properties !== null) {
            $numberOfNeededArguments = count($this->_initializationNeededArguments);

            MethodCallManager::assertArgsNumber($numberOfNeededArguments, $properties);

            for ($i = 0; $i < $numberOfNeededArguments; $i++) {
                $propertyName = $this->_initializationNeededArguments[$i];
                $argument = $properties[$i];

                $this->assertPropertyValue($propertyName, $argument);
                $this->$propertyName = $argument;
                $this->updateInitializedPropertyValue($propertyName, $argument);
            }
        }
    }
1170459
public function getDataProperty($property)
    {
        return isset($this->data[$property]) ? $this->data[$property] : null;
    }
813423
public function set($property, $value = null)
	{
		if (!array_key_exists($property, $this->_tbl->getProperties()))
		{
			$property = '__' . $property;
		}
		$this->_tbl->$property = $value;
		return $this;
	}
1059475
protected function prepareForDatabase($property, $value)
    {
        $type = $this->getPropertyType($property);

        if ($type == 'array' && is_array($value)) {
            return implode(",", $value);
        }
        if (is_bool($value)) {
            $value = (int) $value;
        }

        return $value;
    }
765954
public function setProperties(array $properties) {
		foreach ($this->properties as $prop) {
			$prop->setParent(null);
		}

		$this->properties->clear();

		foreach ($properties as $prop) {
			$this->setProperty($prop);
		}

		return $this;
	}
1258901
public function update($property, $data)
    {
        if (Session::has('multi_language_enabled')) {
            $languageId = $data['language_id'];
            $languaModel = Language::find($languageId);
            
            if ($languaModel->is_default) {
                return $property->update($data);
            } else {
                $translatedModel = $property
                    ->translations()
                    ->whereLanguageId($languageId)
                    ->first();
                if (null === $translatedModel) {
                    return PropertyTranslation::create(
                        array_merge($data, ['property_id' => $property->id])
                    );
                } else {
                    $translatedModel->update(
                        $data,
                        $property->getTranslatedAttributes()
                    );

                    return $translatedModel;
                }

            }
        } else {
            return $category->update($data);
        }
    }
816661
public function setup(array $properties) {
        if (is_array(reset($properties))) {
            $modelList = array();
            foreach ($properties as $p) {
                $o = clone $this;
                $o->setupOne($p);
                $modelList[] = $o;
            }
            return $modelList;
        }

        return $this->setupOne($properties);
    }
999788
public function setPropertyData(array $data)
    {
        $this->propertyData = $data;

        if (!$this->isMergingWidgetData) {
            $this->setCoreData($this->propertyData);
        }

        if ($this->property) {
            $this->property->setData($data);
        }

        return $this;
    }
1366817
public function withProperties(array $properties): self
    {
        $map = $this->properties;

        foreach ($properties as $key => $value) {
            $map = $map->put($key, $value);
        }

        return new self(
            $this->object,
            $map,
            $this->injectionStrategy,
            $this->extractionStrategy
        );
    }
978130
private function setProperties(array $data)
    {
        foreach ($data as $key => $value) {
            $this->setProperty($key, $value);
        }

        return $this;
    }
1318528
public function populate(array $data)
    {
        foreach ($data as $property => $value) {
            if (property_exists($this, $property)) {
                $this->{$property} = $value;
            }
        }
        return $this;
    }