1
0
mirror of synced 2025-02-20 14:13:15 +03:00
This commit is contained in:
doctrine 2006-05-30 22:47:01 +00:00
parent 2e5c96dffb
commit 1c81cb3025
3 changed files with 23 additions and 3 deletions

View File

@ -1104,6 +1104,21 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
final public function hasColumn($name, $type, $length = 20, $options = "") {
$this->table->setColumn($name, $type, $length, $options);
}
/**
* __call
* @param string $m
* @param array $a
*/
public function __call($m,$a) {
if( ! function_exists($m))
throw new Doctrine_Record_Exception("unknown callback");
if(isset($a[0])) {
$column = $a[0];
$this->data[$column] = $m($this->get($column));
}
return $this;
}
/**
* returns a string representation of this object
*/

View File

@ -2,7 +2,12 @@
require_once("UnitTestCase.class.php");
class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
public function testCallback() {
$user = new User();
$user->name = " zYne ";
$user->trim('name');
$this->assertEqual($user->name, 'zYne');
}
public function testJoinTableSelfReferencing() {
$e = new Entity();
$e->name = "Entity test";

View File

@ -25,7 +25,7 @@ $test = new GroupTest("Doctrine Framework Unit Tests");
//$test->addTestCase(new Sensei_UnitTestCase());
$test->addTestCase(new Doctrine_RecordTestCase());
/**
$test->addTestCase(new Doctrine_SessionTestCase());
$test->addTestCase(new Doctrine_TableTestCase());
@ -47,7 +47,7 @@ $test->addTestCase(new Doctrine_Collection_OffsetTestCase());
$test->addTestCase(new Doctrine_CollectionTestCase());
$test->addTestCase(new Doctrine_QueryTestCase());
*/
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());