Skip to content

Commit

Permalink
fix psr-2
Browse files Browse the repository at this point in the history
  • Loading branch information
sizuhiko committed Mar 7, 2015
1 parent 624f4f8 commit 67319e0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Adaptor/CakeFabricateAdaptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CakeFabricateAdaptor extends AbstractFabricateAdaptor
const OPTION_VALIDATE = "validate";

/** option values */
private $_options;
private $options;

/**
* Constructor
Expand All @@ -44,7 +44,7 @@ public function __construct($options = [])
self::OPTION_FILTER_KEY => false,
self::OPTION_VALIDATE => false,
];
$this->_options = array_merge($defaults, $options);
$this->options = array_merge($defaults, $options);
}

/**
Expand Down Expand Up @@ -95,11 +95,11 @@ public function getModel($modelName)
public function create($modelName, $attributes, $recordCount)
{
$table = TableRegistry::get($modelName);
$entities = $table->newEntities($attributes, ['validate' => $this->_options[self::OPTION_VALIDATE]]);
$entities = $table->newEntities($attributes, ['validate' => $this->options[self::OPTION_VALIDATE]]);
$table->connection()->transactional(function () use ($table, $entities) {
foreach ($entities as $entity) {
$ret = $table->save($entity);
if(!$ret) {
if (!$ret) {
return false;
}
}
Expand All @@ -114,8 +114,8 @@ public function create($modelName, $attributes, $recordCount)
public function build($modelName, $data)
{
$table = TableRegistry::get($modelName);
var_dump($this->_options);
$entity = $table->newEntity($data, ['validate' => $this->_options[self::OPTION_VALIDATE]]);
var_dump($this->options);
$entity = $table->newEntity($data, ['validate' => $this->options[self::OPTION_VALIDATE]]);
return $entity;
}

Expand All @@ -125,8 +125,9 @@ public function build($modelName, $data)
* @param string $name field name
* @return true if $name is primary key, otherwise false
*/
protected function filterKey($table, $name) {
if (!$this->_options[self::OPTION_FILTER_KEY]) {
protected function filterKey($table, $name)
{
if (!$this->options[self::OPTION_FILTER_KEY]) {
return false;
}
$primaryKey = $table->primaryKey();
Expand Down

0 comments on commit 67319e0

Please sign in to comment.