示例#1
0
 /**
  * generateAllFor<FieldName>
  **/
 public function generateAllFor($field, $newValvue, $oldValue, $recursive = -1)
 {
     App::uses('CamelCase', 'Lib');
     $camelCase = new CamelCase();
     $fieldFromCamelCase = $camelCase->fromCamelCase($field);
     $succes = $this->generateSomethings($this->name . '.' . $fieldFromCamelCase, $newValvue, $oldValue, $recursive);
     return $succes;
 }
示例#2
0
$t->is($author->getId(), 1);
// Make sure we still have only 2 authors
$authors = Doctrine_Core::getTable('Author')->findAll();
$t->is(count($authors), 2);
$article = new Article();
$article->title = 'test';
// __toString() automatic column finder
$t->is((string) $article, 'test');
// Different style accessors
$t->is($article->getAuthor_id(), $article->author_id);
$t->is($article->getAuthorId(), $article->author_id);
$t->is($article->getauthorId(), $article->author_id);
$t->is($article->getAuthorID(), $article->author_id);
$t->is($article->getauthor_id(), $article->author_id);
// Camel case columns
$camelCase = new CamelCase();
$camelCase->testCamelCase = 'camel';
$camelCase->setTestCamelCase('camel');
$t->is($camelCase->getTestCamelCase(), 'camel');
$t->is($camelCase->gettestCamelCase(), 'camel');
$t->is($camelCase->gettestcamelcase(), 'camel');
$t->is($camelCase->gettest_camel_case(), 'camel');
$t->is($camelCase->getTest_camel_case(), 'camel');
// Propel style accessors work with relationships
$article->setAuthor($author);
$t->is($article->Author, $author);
$t->is($article->getAuthor(), $author);
// Camel case with relationships
$t->is($article->getCamelCase()->getTable()->getOption('name'), 'CamelCase');
// Test getDateTimeObject()
$dateTime = $article->getDateTimeObject('created_at');
示例#3
0
 public function testConvertingToCamelCaseNotationWithLowerFirstLetter()
 {
     $this->assertEquals('thisIsCamelCase', CamelCase::to('this_is_camel_case', false));
 }
示例#4
0
 public function testConvertingToCamelCaseNotation()
 {
     $this->assertEquals('ThisIsCamelCase', CamelCase::to('this_is_camel_case'));
 }