2017 © Pedro PelĂĄez
 

cakephp-plugin select-behavior-cakephp3

Select Finder Behavior for CakePHP 3+

image

orken/select-behavior-cakephp3

Select Finder Behavior for CakePHP 3+

  • Tuesday, October 4, 2016
  • by Orken
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

select-behavior-cakephp3

Create a key-value list with an optionnal group key, compatible with the method find('list')., (*1)

When you want to use 'list' results in javascript, it can be a little tricky because of the lack of fixed key. So, this behavior helps you to get a JS-friendly format for your lists., (*2)

With normal find('list') you'll get your results as :, (*3)

$list = [
  "31555" => "Toulouse",
  "31075" => "Bonrepos sur aussonnelle",
  ...
]

or, with a groupField key :, (*4)

$list = [
  "Midi-Pyrénées" => [
    "31555" => "Toulouse",
    "31075" => "Bonrepos sur aussonnelle",
    ...
  ],
  ...
]

With the behavior 'select', with find('select') you'll get results as :, (*5)

$list = [
  [
    "items" => [
      [
        "key"   => "31555",
        "value" => "Toulouse"
      ],
      [
        "key"   => "31075",
        "value" => "Bonrepos sur Aussonnelle"
      ],
      ...
    ]
  ]
]

and with a groupField key :, (*6)

$list = [
  [
    "group" => "Midi-Pyrénées",
    "items" => [
      [
        "key"   => "31555",
        "value" => "Toulouse"
      ],
      [
        "key"   => "31075",
        "value" => "Bonrepos sur Aussonnelle"
      ],
      ...
    ]
  ],
  ...
]

Installation

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

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

composer require orken/select-behavior-cakephp3

Setting up your CakePHP application

In your bootstrap.php, (*9)

Plugin::load('SelectBehavior');

In each Model/Table file you want to use this behavior add, (*10)

public function initialize(array $config)
{
  ...
  $this->addBehavior('SelectBehavior.Selectlist');
  ...
}

Usage

Syntax is fully complatible with find('list'). Use find('select') instead., (*11)

The Versions

04/10 2016

dev-master

9999999-dev https://github.com/Orken/select-behavior-cakephp3

Select Finder Behavior for CakePHP 3+

  Sources   Download

MIT

The Requires

 

cakephp behavior select find

04/10 2016

1.01

1.01.0.0 https://github.com/Orken/select-behavior-cakephp3

Select Finder Behavior for CakePHP 3+

  Sources   Download

MIT

The Requires

 

cakephp behavior select find

04/10 2016

1.0

1.0.0.0 https://github.com/Orken/select-behavior-cakephp3

Select Finder Behavior for CakePHP 3+

  Sources   Download

MIT

The Requires

 

cakephp behavior select find