function loadSubCapsule($path, $params = '', $name = null)
 {
     $o = parent::loadSubCapsule($path, $params, $name);
     if (isset($o->buffertime)) {
         $this->buffertime = min($this->buffertime, $o->buffertime);
     } else {
         $this->buffertime = 0;
     }
     return $o;
 }
Example #2
0
 public function install()
 {
     /**
      * Création de la table 'forum'
      */
     if (!Capsule::schema()->hasTable('forum')) {
         Capsule::schema()->create('forum', function ($table) {
             $table->increments('id');
             $table->string('name');
             $table->string('description');
             // De cette manière, nous nous assurons que le moteur utilisé
             // supporte les indexes
             $table->engine = 'InnoDB';
             $table->unique('name');
         });
     }
 }
Example #3
0
 /**
  * Attempts to delete the Capsule specified by the ID
  *
  * @param mixed $id The ID of the Capsule to delete
  */
 public function deleteCapsule($id)
 {
     // Make sure the ID exists
     if (!$id) {
         throw new BadRequestException();
     }
     // Set the ID
     $this->Capsule->id = $id;
     // Make sure the Capsule exists and that it belongs to the authenticated User
     if (!$this->Capsule->exists() || !$this->Capsule->ownedBy($this->Auth->user('id'))) {
         throw new NotFoundException();
     }
     // Attempt to delete the Capsule
     if ($this->Capsule->softDelete($id)) {
         // Indicate a no content response
         $this->sendNoContentResponse();
         return;
     } else {
         throw new InternalErrorException();
     }
 }
 /**
  * Adds the propel.xxx properties to the passed Capsule context, changing names to just xxx.
  *
  * Also, move xxx.yyy properties to xxxYyy as PHP doesn't like the xxx.yyy syntax.
  *
  * @param Capsule $context
  * @see getPropelProperties()
  */
 public function populateContextProperties(Capsule $context)
 {
     foreach ($this->getPropelProperties() as $key => $propValue) {
         $this->log('Adding property ${' . $key . '} to context', PROJECT_MSG_DEBUG);
         $context->put($key, $propValue);
     }
 }
Example #5
0
 /**
  * Place useful objects into the initial context.
  *
  *
  * @param  Capsule   $context The context to populate, as retrieved from
  *                            {@link #initControlContext()}.
  * @return void
  * @throws Exception Error while populating context.  The {@link
  *                           #main()} method will catch and rethrow as a
  *                           <code>BuildException</code>.
  */
 protected function populateInitialContext(Capsule $context)
 {
     $this->context->put("now", strftime("%c", time()));
     $this->context->put("task", $this);
 }
Example #6
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
use Illuminate\Container\Container;
$capsule = new Capsule();
$capsule->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'task', 'username' => 'root', 'password' => 'Lennar@123', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
// Set the event dispatcher used by Eloquent models... (optional)
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
$capsule->setEventDispatcher(new Dispatcher(new Container()));
// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent();
 /**
  * Adds the propel build properties to the passed Capsule context.
  *
  * @param      Capsule $context
  * @see        GeneratorConfig::getBuildProperties()
  */
 public function populateContextProperties(Capsule $context)
 {
     foreach ($this->getGeneratorConfig()->getBuildProperties() as $key => $propValue) {
         $this->log('Adding property ${' . $key . '} to context', Project::MSG_DEBUG);
         $context->put($key, $propValue);
     }
 }