$exclude = array();
foreach ($db_columns as $name => $col) {
- if (array_search($name, $exclude) !== false)
- continue;
- $this->addDBField($name, $col);
+ if (array_search($name, $exclude) === false && !isset($col['exclude']))
+ $this->addDBField($name, $col);
}
+
foreach ($db_relations as $name => $relation) {
- if (array_search($name, $exclude) !== false)
- continue;
- $this->addDBRelation($name, $relation, $col);
+ if (array_search($name, $exclude) === false && !isset($relation['exclude']))
+ $this->addDBRelation($name, $relation, $col); // FIXME: $col is undefined
}
} else {
foreach ($user_fields as $uname) {
'sequence',
'protected',
'zerofill',
- 'owner'),
+ 'owner',
+ 'exclude'),
'relation' => array('key',
'class',
'foreignClass',
'foreignAlias',
'foreignType',
+ 'foreignExclude',
'autoComplete',
'onDelete',
'onUpdate',
$newRelation['local'] = $relation['foreign'];
$newRelation['class'] = isset($relation['foreignClass']) ? $relation['foreignClass']:$className;
$newRelation['alias'] = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$className;
+ $newRelation['exclude'] = isset($relation['foreignExclude']) ? $relation['foreignExclude']:$className;
// this is so that we know that this relation was autogenerated and
// that we do not need to include it if it is explicitly declared in the schema by the users.
'equal' => false,
'cascade' => array(), // application-level cascades
'owningSide' => false, // whether this is the owning side
+ 'exclude' => false,
);
public function __construct(array $definition)
public function setTableDefinition()
{
- $this->hasColumn($this->columnName, 'integer', null, '');
+ $this->hasColumn($this->columnName, 'integer', null, array('exclude' => true));
$this->getTable()->listeners['Orderable_'.$this->columnName] = new IPF_ORM_Template_Listener_Orderable($this->columnName);
}
}
--- /dev/null
+<?php
+
+class IPF_ORM_Validator_Exclude
+{
+ public function validate($value)
+ {
+ return true;
+ }
+}
+