public function testFactoryExists()
 {
     $this->assertFalse($this->container->factoryExists('foo'));
     $this->container->factory('foo', function () {
     });
     $this->assertTrue($this->container->factoryExists('foo'));
 }
Exemple #2
0
 public function testFactory()
 {
     $c = new Container();
     $c->factory('service', function () {
         return mt_rand() + mt_rand() + mt_rand();
     });
     $this->assertNotEquals($c->get('service'), $c->get('service'));
 }
  public function before() {
    $session = Container::factory('Session', null, array('name' => 'main'));
    $session->set_timeout(5);

    $this->template_data['global']['assets']['js'][] = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js';
    $this->template_data['global']['assets']['js'][] = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js';
    $this->template_data['global']['assets']['js'][] = '/js/loopedslider.js';

    return parent::before();
  }
Exemple #4
0
 public function action_archive() {
   $this->template_data['global']['title']['description'] = 'Archives';
   $this->template_data['posts'] = Container::factory('doctrine')->createQuery("SELECT p FROM Model_News_Post p ORDER BY p.time DESC")->setMaxResults(10)->getArrayResult();
 }
 public function action_newsposts() {
   $this->template_data['posts'] = Container::factory('doctrine')->createQuery("SELECT p.name AS post_name, p.id AS post_id, pu.name AS user_name, pu.id AS user_id FROM Model_News_Post p LEFT JOIN p.user pu ORDER BY p.time DESC")->setMaxResults(10)->getArrayResult();
 }