1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Schema classes updated

This commit is contained in:
zYne 2006-09-26 12:30:47 +00:00
parent 79cbc45510
commit 5cb3086d80
3 changed files with 48 additions and 103 deletions

View File

@ -38,14 +38,13 @@ class Doctrine_Schema_Column extends Doctrine_Schema_Object implements IteratorA
* column definitions
* @var array $definition
*/
private $definition = array('name' => '',
'type' => '',
'unique' => false,
'primary' => false,
'notnull' => false,
'default' => null,
);
protected $definition = array('name' => '',
'type' => '',
'unique' => false,
'primary' => false,
'notnull' => false,
'default' => null,
);
public function __construct(array $definition) {
foreach($this->definition as $key => $val) {
@ -71,5 +70,4 @@ class Doctrine_Schema_Column extends Doctrine_Schema_Object implements IteratorA
public function isNotNull() {
return $this->definition['notnull'];
}
} // end of Doctrine_Schema_Column
}

View File

@ -33,69 +33,35 @@
* class Doctrine_Schema_Object
* Catches any non-property call from child classes and throws an exception.
*/
abstract class Doctrine_Schema_Object
implements IteratorAggregate, Countable
{
/** Aggregations: */
/** Compositions: */
/*** Attributes: ***/
/**
*
* @param string _property
* @param mixed _value
* @return
* @access public
*/
public function __set( $_property, $_value )
{
throw new Doctrine_Schema_Exception('Assignment of non-property');
} // end of member function __set
/**
*
* @param string _property
* @return
* @access public
*/
public function __get( $_property )
{
throw new Doctrine_Schema_Exception('Access of non-property');
} // end of member function __get
abstract class Doctrine_Schema_Object implements IteratorAggregate, Countable {
protected $children = array();
protected $definition = array();
/**
*
* @return int
* @access public
*/
public function count( )
{
if(!empty($this->childs))
{
public function count() {
if( ! empty($this->childs))
return count($this->childs);
}
return 0;
return count($this->definition);
}
/**
* getIterator
*
* @return
* @return ArrayIterator
* @access public
*/
public function getIterator( )
{
if(!empty($this->childs))
{
public function getIterator() {
if( ! empty($this->childs))
return new ArrayIterator($this->childs);
}
return new ArrayIterator();
return new ArrayIterator($this->definition);
}
} // end of Doctrine_Schema_Object
}

View File

@ -37,14 +37,6 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object
implements Countable, Countable, IteratorAggregate
{
/** Aggregations: */
/** Compositions: */
var $m_Vector = array();
var $m_;
/*** Attributes: ***/
/**
* Unique key fields
* @access public
@ -85,32 +77,6 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object
* @access public
*/
public $description;
/**
* Columns of the table
* @access private
*/
private $childs;
/**
*
* @return
* @access public
*/
public function __toString( ) {
} // end of member function __toString
/**
*
* @return
* @access public
*/
public function __clone( ) {
} // end of member function __clone
/**
*
* @return bool
@ -118,20 +84,35 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object
*/
public function isValid( ) {
} // end of member function isValid
}
/**
* returns an array of Doctrine_Schema_Column objects
*
* @return array
*/
public function getColumns() {
return $this->children;
}
/**
* @return Doctrine_Schema_Column|false
*/
public function getColumn($name) {
if( ! isset($this->children[$name]))
return false;
return $this->children[$name];
}
/**
*
* @param Doctrine_Schema_Column column * @return Doctrine_Schema_Column
* @param Doctrine_Schema_Column column
* @return Doctrine_Schema_Table
* @access public
*/
public function addColumn( $column = null ) {
} // end of member function addColumn
public function addColumn(Doctrine_Schema_Column $column) {
$name = $column->getName();
$this->children[$name] = $column;
return $this;
}
} // end of Doctrine_Schema_Table
}