2017 © Pedro Peláez
 

cakephp-plugin sensors

Sensors plugin for CakePHP

image

sasilen/sensors

Sensors plugin for CakePHP

  • Saturday, December 16, 2017
  • by sasilen
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Sensors plugin for CakePHP 4

Installation

You can install this plugin into your CakePHP application using composer., (*1)

The recommended way to install composer packages is:, (*2)

composer config repositories.sensors git https://github.com/sasilen/cakephp-plugin-sensors.git
composer require sasilen/sensors

Configuration

Load required modules with routes, (*3)

./bin/cake plugin load Sasilen/Sensors

Migrate database schema, (*4)

./bin/cake migrations migrate -p Sensors

Add templates (main app)

# /src/View/AppView.php
public function initialize(): void
{
    parent::initialize();
    $this->loadHelper('CakeDC/Users.AuthLink');
    $this->loadHelper('Paginator', ['templates' => 'templates-paginator']);
    $this->loadHelper('Form', ['templates' => 'templates-form']);
}

Triggers

If you want to update sensor_id automatically from the sensors list when sensor_value is inserted you can create these two trigger, (*5)

CREATE TRIGGER sensor_values_sensor_id_updater
BEFORE UPDATE ON sensor_values
    FOR EACH ROW
          SET new.sensor_id = (select id from sensors where name=new.name);

CREATE TRIGGER sensor_values_sensor_id_inserter
BEFORE INSERT ON sensor_values
    FOR EACH ROW
          SET new.sensor_id = (select id from sensors where name=new.name);

FIX missing:
UPDATE sensor_values SET sensor_values.sensor_id = (SELECT sensors.id FROM sensors WHERE sensors.name = sensor_values.name ) WHERE sensor_values.sensor_id = '';

The Versions

16/12 2017

dev-master

9999999-dev

Sensors plugin for CakePHP

  Sources   Download

The Requires

 

The Development Requires