parent
3b24837755
commit
db433c8449
@ -1385,23 +1385,63 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
}
|
||||
}
|
||||
}
|
||||
public function setAttribute($attr, $value) {
|
||||
$this->table->setAttribute($attr, $value);
|
||||
}
|
||||
public function setTableName($tableName) {
|
||||
$this->table->setTableName($tableName);
|
||||
}
|
||||
public function setInheritanceMap($map) {
|
||||
$this->table->setInheritanceMap($map);
|
||||
}
|
||||
public function setEnumValues($column, $values) {
|
||||
$this->table->setEnumValues($column, $values);
|
||||
}
|
||||
/**
|
||||
* __call
|
||||
* @param string $m
|
||||
* @param array $a
|
||||
* addListener
|
||||
*
|
||||
* @param Doctrine_DB_EventListener_Interface|Doctrine_Overloadable $listener
|
||||
* @return Doctrine_DB
|
||||
*/
|
||||
public function __call($m,$a) {
|
||||
if(method_exists($this->table, $m))
|
||||
return call_user_func_array(array($this->table, $m), $a);
|
||||
public function addListener($listener, $name = null) {
|
||||
$this->table->addListener($listener, $name = null);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* getListener
|
||||
*
|
||||
* @return Doctrine_DB_EventListener_Interface|Doctrine_Overloadable
|
||||
*/
|
||||
public function getListener() {
|
||||
return $this->table->getListener();
|
||||
}
|
||||
/**
|
||||
* setListener
|
||||
*
|
||||
* @param Doctrine_DB_EventListener_Interface|Doctrine_Overloadable $listener
|
||||
* @return Doctrine_DB
|
||||
*/
|
||||
public function setListener($listener) {
|
||||
$this->table->setListener($listener);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* call
|
||||
*
|
||||
* @param string|array $callback valid callback
|
||||
* @param string $column column name
|
||||
* @param mixed arg1 ... argN optional callback arguments
|
||||
* @return Doctrine_Record
|
||||
*/
|
||||
public function call($callback, $column) {
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
if( ! function_exists($m))
|
||||
throw new Doctrine_Record_Exception("unknown callback '$m'");
|
||||
if(isset($args[0])) {
|
||||
$column = $args[0];
|
||||
$args[0] = $this->get($column);
|
||||
|
||||
if(isset($a[0])) {
|
||||
$column = $a[0];
|
||||
$a[0] = $this->get($column);
|
||||
|
||||
$newvalue = call_user_func_array($m, $a);
|
||||
$newvalue = call_user_func_array($callback, $args);
|
||||
|
||||
$this->data[$column] = $newvalue;
|
||||
}
|
||||
|
7
tests/QuerySelectTestCase.php
Normal file
7
tests/QuerySelectTestCase.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase {
|
||||
public function testAsteriskSelecting() {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
@ -21,7 +21,9 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertFalse(isset($user['id']));
|
||||
$this->assertFalse($user->contains('id'));
|
||||
}
|
||||
public function testUnknownColumn() {
|
||||
|
||||
}
|
||||
public function testNotNullConstraint() {
|
||||
$null = new NotNullTest();
|
||||
|
||||
@ -287,9 +289,9 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
||||
public function testCallback() {
|
||||
$user = new User();
|
||||
$user->name = " zYne ";
|
||||
$user->trim('name');
|
||||
$user->call('trim', 'name');
|
||||
$this->assertEqual($user->name, 'zYne');
|
||||
$user->substr('name',0,1);
|
||||
$user->call('substr', 'name', 0, 1);
|
||||
$this->assertEqual($user->name, 'z');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user