コード例 #1
0
 function testLoadingWithMultipleAssociations()
 {
     $articles = SActiveStore::findAll('Article', Null, array('include' => array('comments', 'categories')));
     $this->assertTrue($articles[0]->comments->isLoaded());
     $this->assertEqual(2, $articles[0]->countComments());
     $this->assertTrue($articles[0]->categories->isLoaded());
     $this->assertEqual(3, $articles[0]->countCategories());
 }
コード例 #2
0
 protected function findTarget()
 {
     return SActiveStore::findAll($this->assocClass, $this->constructSql());
 }
コード例 #3
0
 public function getPage($page)
 {
     return SActiveStore::findAll($this->className, $this->condition, $this->sqlOptions($page));
 }
コード例 #4
0
 public function index()
 {
     $this->{$this->plural_name} = SActiveStore::findAll($this->class_name);
     $this->renderScaffold();
 }
コード例 #5
0
 function testDelete()
 {
     $this->assertEqual(array($this->topics['list_1'], $this->topics['list_2'], $this->topics['list_3'], $this->topics['list_4']), SActiveStore::findAll('Topic', 'forum_id = 1', array('order' => 'position ASC')));
     $topic = new SListDecorator($this->topics['list_2'], 'forum');
     $topic->delete();
     $this->instanciateFixtures();
     $this->assertEqual(array($this->topics['list_1'], $this->topics['list_3'], $this->topics['list_4']), SActiveStore::findAll('Topic', 'forum_id = 1', array('order' => 'position ASC')));
     $this->assertEqual(1, $this->topics['list_1']->position);
     $this->assertEqual(2, $this->topics['list_3']->position);
     $this->assertEqual(3, $this->topics['list_4']->position);
     $topic = new SListDecorator($this->topics['list_1'], 'forum');
     $topic->delete();
     $this->instanciateFixtures();
     $this->assertEqual(array($this->topics['list_3'], $this->topics['list_4']), SActiveStore::findAll('Topic', 'forum_id = 1', array('order' => 'position ASC')));
     $this->assertEqual(1, $this->topics['list_3']->position);
     $this->assertEqual(2, $this->topics['list_4']->position);
 }
コード例 #6
0
 function testFindWithBindedCondition()
 {
     $companies = SActiveStore::findAll('Company', array("name = :company", array(':company' => 'Groupe W')));
     $this->assertEqual(1, count($companies));
 }