30 implements IteratorAggregate, Countable
35 protected $_data = array();
64 $this->_table = $table;
80 $data = $this->_table->getCleanSchema();
82 if (!empty($data[$key])) {
83 $schema = $data[$key];
99 foreach ($config as $itemName => $itemConfig) {
100 if (!$this->
has($itemName)) {
101 $this->
add(
new $classname($itemName, $this->_table));
105 foreach ($this->_data as $i => $item) {
106 if (!isset($config[$item->getOriginName()])) {
107 $item->markDeleted();
122 if (!$item instanceof $classname) {
124 "Definition must be instance of '{$classname}'"
128 if ($name && $this->
has($name)) {
130 "Definition by name '$name' already exists in " . get_class($this)
133 $item =
new $classname($name, $this->_table);
135 $this->_data[] = $item;
147 foreach ($this->_data as $item) {
148 if ($item->isDirty()) {
163 foreach ($this->_data as $item) {
164 $data[$item->getName()] = $item->toArray();
176 return new ArrayIterator($this->_data);
185 public function has($name)
187 return null !== $this->
get($name);
196 public function get($name)
198 foreach ($this->_data as $i => $item) {
199 if ($item->getName() == $name) {
213 return count($this->_data);