@@ -28,12 +28,12 @@ composer require itosho/easy-query
2828$this->Tags = TableRegistry::get('Tags');
2929$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
3030 'uniqueColumns' => ['name'],
31- 'updateColumns' => ['description', 'modified']
31+ 'updateColumns' => ['description', 'modified'],
3232]);
3333
3434$data = [
3535 'name' => 'cakephp',
36- 'description' => 'php web framework'
36+ 'description' => 'php web framework',
3737];
3838$entity = $this->Tags->newEntity($data);
3939$this->Tags->upsert($entity);
@@ -44,17 +44,17 @@ $this->Tags->upsert($entity);
4444``` php
4545$this->Tags = TableRegistry::get('Tags');
4646$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
47- 'updateColumns' => ['description', 'modified']
47+ 'updateColumns' => ['description', 'modified'],
4848]);
4949
5050$data = [
5151 [
5252 'name' => 'cakephp',
53- 'description' => 'php web framework'
53+ 'description' => 'php web framework',
5454 ],
5555 [
5656 'name' => 'rubyonrails',
57- 'description' => 'ruby web framework'
57+ 'description' => 'ruby web framework',
5858 ]
5959];
6060$entities = $this->Tags->newEntities($data);
@@ -71,12 +71,12 @@ $data = [
7171 [
7272 'title' => 'First Article',
7373 'body' => 'First Article Body',
74- 'published' => '1'
74+ 'published' => '1',
7575 ],
7676 [
7777 'title' => 'Second Article',
7878 'body' => 'Second Article Body',
79- 'published' => '0'
79+ 'published' => '0',
8080 ]
8181];
8282$entities = $this->Articles->newEntities($data);
@@ -95,12 +95,10 @@ $this->Articles->addBehavior('Itosho/EasyQuery.Insert');
9595
9696$data = [
9797 'title' => 'New Article?',
98- 'body' => 'New Article Body?'
98+ 'body' => 'New Article Body?',
9999];
100100$entity = $this->Articles->newEntity($data);
101- $condition = [
102- 'title' => 'New Article?'
103- ];
101+ $condition = ['title' => 'New Article?'];
104102
105103$this->Articles->insertOnce($entities);
106104```
@@ -123,7 +121,7 @@ $this->Articles->addBehavior('Itosho/EasyQuery.Insert');
123121
124122$data = [
125123 'title' => 'New Article',
126- 'body' => 'New Article Body'
124+ 'body' => 'New Article Body',
127125];
128126$entity = $this->Articles->newEntity($data);
129127
@@ -146,7 +144,7 @@ And you can change the action manually by using `event` config like this.
146144``` php
147145// default value is true
148146$this->Articles->addBehavior('Itosho/EasyQuery.Insert', [
149- 'event' => ['beforeSave' => false]
147+ 'event' => ['beforeSave' => false],
150148]);
151149```
152150
0 commit comments