Пример #1
0
 /**
  * Uses the static method approach if our DI var is null
  *
  * @return Object
  * @author Dan Cox
  */
 public function __get($service)
 {
     if (is_null($this->DI)) {
         return DI::get($service);
     }
     return $this->DI->get($service);
 }
Пример #2
0
 /**
  * Returns a database object loaded with the model name
  *
  * @return Database
  * @author Dan Cox
  */
 public static function db()
 {
     $entity = get_called_class();
     $db = DI::get('database');
     $db->setModel($entity);
     return $db;
 }
Пример #3
0
 /**
  * Test the delete function
  *
  * @return void
  * @author Dan Cox
  */
 public function test_removeModel()
 {
     DI::addMock('database', $this->database);
     $this->database->shouldReceive('getEntity')->andReturn($this->database);
     $this->database->shouldReceive('remove');
     $this->database->shouldReceive('flush');
     $this->entity->delete();
 }