Skip to content

Instantly share code, notes, and snippets.

@markstory
Created January 17, 2017 03:00
Show Gist options
  • Save markstory/ec56a76efdbfd5e54bf4cfe273cad2de to your computer and use it in GitHub Desktop.
Save markstory/ec56a76efdbfd5e54bf4cfe273cad2de to your computer and use it in GitHub Desktop.
'lookup' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => 'false,',
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'lookup',
'encoding' => 'utf8',
'cacheMetadata' => false,
'quoteIdentifiers' => true,
],
'test_lookup' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => 'false,',
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'test_lookup',
'encoding' => 'utf8',
'cacheMetadata' => false,
'quoteIdentifiers' => true,
],
<?php
namespace App\Test\Fixture;
use Cake\TestSuite\Fixture\TestFixture;
/**
* TimeSheetsFixture
*
*/
class TimeSheetsFixture extends TestFixture
{
public $connection = 'test_lookup';
/**
* Fields
*
* @var array
*/
// @codingStandardsIgnoreStart
public $fields = [
'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],
'start_time' => ['type' => 'datetime', 'length' => null, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null],
'end_time' => ['type' => 'datetime', 'length' => null, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null],
'rate' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
'notes' => ['type' => 'text', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
],
'_options' => [
'engine' => 'InnoDB',
'collation' => 'utf8_general_ci'
],
];
// @codingStandardsIgnoreEnd
/**
* Records
*
* @var array
*/
public $records = [
[
'id' => 1,
'start_time' => '2015-09-30 01:50:10',
'end_time' => '2015-09-30 01:50:10',
'rate' => 1,
'notes' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.'
],
];
}
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\Table;
use Cake\Database\Schema\Table as Schema;
use Cake\ORM\RulesChecker;
use Cake\Validation\Validator;
/**
* TimeSheets Model
*/
class TimeSheetsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
$this->table('time_sheets');
$this->primaryKey('id');
}
public static function defaultConnectionName()
{
return 'lookup';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment