<?php
/**
* @version 1.0.0
* @category Anahita Social Engineâ¢
* @copyright Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.anahitapolis.com
*/
abstract class AnDomainDescriptionProperty extends KObject implements KFactoryIdentifiable
{
protected $_name;
protected $_mapper;
protected $_unique;
protected $_selectable;
protected $_required;
protected $_identifier;
public function __construct(array $options = array())
{
$this->_identifier = $options['identifier'];
$this->_name = $options['name'];
$this->_mapper = $options['mapper'];
$options = $this->_initialize($options);
if ( !isset($options['unique']) ){
die;
}
$this->_unique = $options['unique'];
$this->_selectable = $options['select'];
$this->_required = $options['required'];
}
/**
*
* @return
* @param $options Object[optional]
*/
protected function _initialize($options=array())
{
$default = array(
'unique' => false ,
'required' => false ,
'select' => true ,
);
return array_merge($default, $options);
}
/**
* Name of the property
*
* @return string
*/
public function getName()
{
return $this->_name;
}
/**
* Mapper Object
*
* @return
*/
public function getMapper()
{
return $this->_mapper;
}
/**
*
* @return
* @param $required Object
*/
public function setRequired($required)
{
$this->_required = $required;
return $this;
}
/**
* Is the property required or optional
*
* @return bool
*/
public function isRequired()
{
return $this->_required;
}
/**
*
* @return
* @param $unique Object
*/
public function setUnique($unique)
{
$this->_unique = $unique;
return $this;
}
/**
* Is it a unique property
*
* @return
*/
public function isUnique()
{
return $this->_unique;
}
/**
* Is it selectable
*
* @return
*/
public function isSelectable()
{
return $this->_selectable;
}
/**
*
*
* @return
*/
public function getType()
{
return null;
}
/**
*
*
* @return
*/
public function getIdentifier()
{
return $this->_identifier;
}
/**
* Return the table fields mapped to this property
*
* @return array
*/
abstract public function getTableFields();
abstract public function getTableValues($value);
abstract public function validatePresenceOf($value);
/**
*
* @return
*/
abstract public function getAttrTree();
/**
*
* @return
* @param $value Object
*/
abstract public function serialize($value);
/**
*
* @return
* @param $data Object
*/
//abstract public function materialize($data);
}