. */ /** * @package Doctrine * @url http://www.phpdoctrine.com * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @author Jukka Hassinen * @version $Id$ */ /** * class Doctrine_Schema_Object * Catches any non-property call from child classes and throws an exception. */ abstract class Doctrine_Schema_Object implements IteratorAggregate, Countable { protected $children = array(); protected $definition = array('name' => ''); public function __construct(array $definition) { foreach($this->definition as $key => $val) { if(isset($definition[$key])) $this->definition[$key] = $definition[$key]; } } public function getName() { return $this->definition['name']; } /** * * @return int * @access public */ public function count() { if( ! empty($this->childs)) return count($this->childs); return count($this->definition); } /** * getIterator * * @return ArrayIterator * @access public */ public function getIterator() { if( ! empty($this->childs)) return new ArrayIterator($this->childs); return new ArrayIterator($this->definition); } }