* implemented the loadFromArray method (and test)...
[vsc.git] / _res / _libs / models / foo / indexes / fooindexa.class.php
blobd890c16665a097264536921c39f1a7d7cf7221d6
1 <?php
2 /**
3 * @package ts_models
4 * @author Marius Orcsik <marius@habarnam.ro>
5 * @date 09.03.19
6 */
8 abstract class fooIndexA implements fooFieldI {
9 protected $name;
10 protected $fields = array();
12 public function __construct ($mIncomingStuff = null) {
13 if (is_array ($mIncomingStuff)) {
14 $this->setName($mIncomingStuff[0]->getName());
15 foreach ($mIncomingStuff as $oField) {
16 if (fooFieldA::isValid($oField))
17 $this->addField ($oField);
18 else
19 throw new fooIndexException ('The object passed can not be used as a primary key.');
21 } else {
22 throw new fooIndexException ('The data used to instantiate the table\'s primary key is invalid.');
26 // abstract public function getName ();
28 // abstract public function setName ($sName);
30 public function addField (fooFieldA $oField) {
31 $this->fields[$oField->getName()] = $oField;
34 // public function removeField (fooFieldA $oField) {
35 // if (isset ($this->fields[$oField->getName()]))
36 // unset($this->fields[$oField->getName()]);
37 // }
39 public function getIndexComponents () {
40 return implode (', ', array_keys($this->fields));