davidsteinsland/cakephp-state-machine — pull request #7 by FrodeMMeling (2014-03-27 20:50:37+00:00)
Title: Find by states and new dotgenerator

This pull adds new functionallity to statemachine:

## New find methods
### findAllByState
Finds all records in a specific state. Supports additional conditions, but will overwrite conditions with state
### findFirstByState
Finds first record in a specific state. Supports additional conditions, but will overwrite conditions with state
### findCountByState
Finds count of records in a specific state. Supports additional conditions, but will overwrite conditions with state

## New Graphviz functions
### prepareForDotWithRoles
This function could be protected, but is public. can be nice if you need an array representation of all transitions with transactions, depends and roles in one array. Can be used for presentation of state-machine. createDotFileForRoles uses this for preparation of array
### createDotFileForRoles
Creates a graphical representation of the statemachine with its depends and roles. you can also add visual styling to the generation, so arrows are colored based on roles. It is easy to extend this now since it is written with this in mind

Here is a new image of how the new Dot function works:
![statemachine](https://cloud.githubusercontent.com/assets/3490043/2543309/f95a8f0e-b5f0-11e3-9cb1-13b335c27b1c.png)

## Simple Console
This is very beta and needs much more work.. Needs option parsing, more validations and tests.

this one command will generate png files for all roles combined and individual image for each role
```
cake StateMachine.dot generate all test.png
```
For the example in statemachine this will output to APP TMP folder:
test.png (all roles combined)
driver_test.png
thief_test.png
mechanic_test.png