2017 © Pedro Peláez
 

cakephp-plugin cakephp-metabehavior

CakePHP MetaBehavior Plugin, dealing with additional datas

image

p0lym0rphik/cakephp-metabehavior

CakePHP MetaBehavior Plugin, dealing with additional datas

  • Wednesday, April 22, 2015
  • by p0lym0rphik
  • Repository
  • 1 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Coverage Status Build Status, (*1)

CakePHP MetaBehavior

Join the chat at https://gitter.im/p0lym0rphik/cakephp-metabehavior, (*2)

Introduction

CakePHP Metabehavior is a meta data Behavior for CakePHP 2. This behavior allows you to store, retrieve and search for metadata about any record for any model within your database., (*3)

Installation

  1. Add the folder on your app/Plugin directory., (*4)

  2. Make sure that the Plugin is loaded (check your bootstrap configuration)., (*5)

  3. Run the following commands:, (*6)

cd /path/to/installation/
app/Console/cake schema create MetaBehavior.metas
  1. Add the behavior to the model you want to use.
class MyModel extends Model {
    public $actsAs = array('Meta');
}

How to

  1. Add datas to an object.
// Just set meta key on the primary request model
    $savedDatas = $this->request->data;
    $savedDatas['MyModel']['foo'] = 'bar';
    
    $this->MyModel->save($savedDatas);
  1. Retrieve datas.
    // Just launch a find and datas are in the primary model.

    $model = $this->MyModel->findByid(1);
    
    return array(
        'MyModel' => array(
            'id' => 1,
            'foo' => 'bar'
        )
    )   
  1. You can directly search on meta values.
    $this->MyModel->find('all',array(
        'conditions' => array(
            'MyModel.foo =' => 'bar'
        )
    ));

Licence GPL2

CakePHP MetaBehavior plugin Copyright (C) 2014 Fabien Moreau, (*7)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version., (*8)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details., (*9)

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA., (*10)

The Versions

22/04 2015

dev-master

9999999-dev https://github.com/p0lym0rphik/cakephp-metabehavior

CakePHP MetaBehavior Plugin, dealing with additional datas

  Sources   Download

GPL-2.0

The Requires

 

cakephp metadatas metabehavior extradata