# css-javascript-toolbox/8.2/framework/ServicesFW/EntityModel.class.php

CSS &amp; JavaScript Toolbox, version 8.2. 66 lines.

- Page: https://pluginprobe.com/plugins/css-javascript-toolbox/8.2/code/framework/ServicesFW/EntityModel.class.php
- Raw: https://pluginprobe.com/plugins/css-javascript-toolbox/8.2/raw/framework/ServicesFW/EntityModel.class.php
- Modified: 2016-03-05T15:13:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/css-javascript-toolbox/8.2/code/framework/ServicesFW/EntityModel.class.php#L10-L20`.

```php
<?php
/**
* 
*/

/**
* 
*/
abstract class CJTServicesEntityModel {
	
	/**
	* put your comment there...
	* 
	* @param mixed $data
	* @return CJTServicesItemModel
	*/
	public function __construct($data = null) {
		# Make sure data is array
		if( ! $data ) {
			$data = array();
		}
		# Fill with data
		$this->exchangeArray( $data );
	}

	/**
	* put your comment there...
	* 
	* @param mixed $data
	*/
	public function exchangeArray($data) {
		# Fetch properties for all model members
		foreach ( get_object_vars( $this ) as $name => $value ) {
			$this->$name = isset( $data[ $name ] ) ? $data[ $name ] : null;
		}
		# Chain
		return $this;
	}
	
	/**
	* put your comment there...
	* 
	*/
	public function getArray() {
		# Gett all vars
		$vars = get_object_vars( $this );
		# Exclude NULL values
		foreach ( $vars as $name => $value ) {
			if ( $value === null ) {
				unset( $vars[ $name ] );
			}
		}
		return $vars;
	}

	/**
	* put your comment there...
	* 
	* @param CJTServicesEntityModel $model
	* @return CJTServicesEntityModel
	*/
	public function isEqual(CJTServicesEntityModel & $model) {
		return md5( print_r( get_object_vars( $this ), true ) ) == md5( print_r( get_object_vars( $model ), true ) );
	}
}

```
