Skip to content

Commit 0593372

Browse files
authored
Merge pull request #96 from niden/master
5.6.0
2 parents 6e3c59e + 2d4e124 commit 0593372

File tree

16 files changed

+365
-163
lines changed

16 files changed

+365
-163
lines changed

src/DataMapper/Query/AbstractQuery.php

+75-1
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,82 @@ public function quoteIdentifier(string $name, int $type = \PDO::PARAM_STR): stri
127127

128128
/**
129129
* Resets the internal array
130+
*
131+
* @return void
132+
*/
133+
public function reset(): void
134+
{
135+
}
136+
137+
/**
138+
* Resets the columns
139+
*
140+
* @return void
141+
*/
142+
public function resetColumns(): void
143+
{
144+
}
145+
146+
/**
147+
* Resets the from
148+
*
149+
* @return void
150+
*/
151+
public function resetFrom(): void
152+
{
153+
}
154+
155+
/**
156+
* Resets the where
157+
*
158+
* @return void
159+
*/
160+
public function resetWhere(): void
161+
{
162+
}
163+
164+
/**
165+
* Resets the group by
166+
*
167+
* @return void
168+
*/
169+
public function resetGroupBy(): void
170+
{
171+
}
172+
173+
/**
174+
* Resets the having
175+
*
176+
* @return void
177+
*/
178+
public function resetHaving(): void
179+
{
180+
}
181+
182+
/**
183+
* Resets the order by
184+
*
185+
* @return void
186+
*/
187+
public function resetOrderBy(): void
188+
{
189+
}
190+
191+
/**
192+
* Resets the limit and offset
193+
*
194+
* @return void
195+
*/
196+
public function resetLimit(): void
197+
{
198+
}
199+
200+
/**
201+
* Resets the flags
202+
*
203+
* @return void
130204
*/
131-
public function reset()
205+
public function resetFlags(): void
132206
{
133207
}
134208

src/DataMapper/Query/Select.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ public function orHaving(string $condition, $value = null, int $type = -1): Sele
212212
/**
213213
* Resets the internal collections
214214
*
215-
* @return Select
215+
* @return void
216216
*/
217-
public function reset(): Select
217+
public function reset(): void
218218
{
219219
}
220220

src/Db/AbstractDb.php

-68
This file was deleted.

src/Db/Adapter/AbstractAdapter.php

+53-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,49 @@
2222
use Phalcon\Events\ManagerInterface;
2323

2424
/**
25-
* Base class for Phalcon\Db\Adapter adapters
25+
* Base class for Phalcon\Db\Adapter adapters.
26+
*
27+
* This class and its related classes provide a simple SQL database interface
28+
* for Phalcon Framework. The Phalcon\Db is the basic class you use to connect
29+
* your PHP application to an RDBMS. There is a different adapter class for each
30+
* brand of RDBMS.
31+
*
32+
* This component is intended to lower level database operations. If you want to
33+
* interact with databases using higher level of abstraction use
34+
* Phalcon\Mvc\Model.
35+
*
36+
* Phalcon\Db\AbstractDb is an abstract class. You only can use it with a
37+
* database adapter like Phalcon\Db\Adapter\Pdo
38+
*
39+
* ```php
40+
* use Phalcon\Db;
41+
* use Phalcon\Db\Exception;
42+
* use Phalcon\Db\Adapter\Pdo\Mysql as MysqlConnection;
43+
*
44+
* try {
45+
* $connection = new MysqlConnection(
46+
* [
47+
* "host" => "192.168.0.11",
48+
* "username" => "sigma",
49+
* "password" => "secret",
50+
* "dbname" => "blog",
51+
* "port" => "3306",
52+
* ]
53+
* );
54+
*
55+
* $result = $connection->query(
56+
* "SELECT FROM co_invoices LIMIT 5"
57+
* );
58+
*
59+
* $result->setFetchMode(Enum::FETCH_NUM);
60+
*
61+
* while ($invoice = $result->fetch()) {
62+
* print_r($invoice);
63+
* }
64+
* } catch (Exception $e) {
65+
* echo $e->getMessage(), PHP_EOL;
66+
* }
67+
* ```
2668
*/
2769
abstract class AbstractAdapter implements \Phalcon\Db\Adapter\AdapterInterface, \Phalcon\Events\EventsAwareInterface
2870
{
@@ -808,6 +850,16 @@ public function setNestedTransactionsWithSavepoints(bool $nestedTransactionsWith
808850
{
809851
}
810852

853+
/**
854+
* Enables/disables options in the Database component
855+
*
856+
* @param array $options
857+
* @return void
858+
*/
859+
public static function setup(array $options): void
860+
{
861+
}
862+
811863
/**
812864
* Returns a SQL modified with a LOCK IN SHARE MODE clause
813865
*

src/Db/Adapter/Pdo/Mysql.php

-19
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,6 @@ class Mysql extends \Phalcon\Db\Adapter\Pdo\AbstractPdo
4848
*/
4949
protected $type = 'mysql';
5050

51-
/**
52-
* Constructor for Phalcon\Db\Adapter\Pdo
53-
*
54-
* @param array $descriptor = [
55-
* 'host' => 'localhost',
56-
* 'port' => '3306',
57-
* 'dbname' => 'blog',
58-
* 'username' => 'sigma'
59-
* 'password' => 'secret'
60-
* 'dialectClass' => null,
61-
* 'options' => [],
62-
* 'dsn' => null,
63-
* 'charset' => 'utf8mb4'
64-
* ]
65-
*/
66-
public function __construct(array $descriptor)
67-
{
68-
}
69-
7051
/**
7152
* Adds a foreign key to a table
7253
*

src/Di/Di.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ protected function loadFromConfig(\Phalcon\Config\ConfigInterface $config): void
232232
* ];
233233
* ```
234234
*
235-
* @link https://docs.phalcon.io/en/latest/reference/di.html
235+
* @link https://docs.phalcon.io/latest/di/
236236
* @param string $filePath
237237
* @return void
238238
*/
@@ -271,7 +271,7 @@ public function loadFromPhp(string $filePath): void
271271
* className: \Acme\User
272272
* ```
273273
*
274-
* @link https://docs.phalcon.io/en/latest/reference/di.html
274+
* @link https://docs.phalcon.io/latest/di/
275275
* @param string $filePath
276276
* @param array $callbacks
277277
* @return void

src/Filter/Validation/Validator/Uniqueness.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ class Uniqueness extends AbstractCombinedFieldsValidator
9999
* Constructor
100100
*
101101
* @param array $options = [
102-
* 'message' => '',
103-
* 'template' => '',
102+
* 'message' => '',
103+
* 'template' => '',
104104
* 'allowEmpty' => false,
105-
* 'convert' => null,
106-
* 'model' => null,
107-
* 'except' => null
105+
* 'convert' => null,
106+
* 'model' => null,
107+
* 'except' => null
108108
* ]
109109
*/
110110
public function __construct(array $options = [])

src/Html/Helper/Input/Select.php

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
/**
1515
* Class Select
16-
*
17-
* @property string $elementTag
18-
* @property bool $inOptGroup
19-
* @property string $selected
2016
*/
2117
class Select extends AbstractList
2218
{

src/Mvc/Model.php

+17-7
Original file line numberDiff line numberDiff line change
@@ -1515,26 +1515,36 @@ public static function sum($parameters = null): ResultsetInterface|float
15151515
* ```
15161516
*
15171517
* @param array $columns
1518+
* @param mixed $useGetter
15181519
* @return array
15191520
*/
1520-
public function toArray($columns = null): array
1521+
public function toArray($columns = null, $useGetter = true): array
15211522
{
15221523
}
15231524

15241525
/**
15251526
* Updates a model instance. If the instance doesn't exist in the
1526-
* persistence it will throw an exception. Returning true on success or
1527-
* false otherwise.
1527+
* persistence it will throw an exception. Returning `true` on success or
1528+
* `false` otherwise.
15281529
*
15291530
* ```php
1530-
* // Updating a robot name
1531-
* $robot = Robots::findFirst("id = 100");
1531+
* <?php
15321532
*
1533-
* $robot->name = "Biomass";
1533+
* use MyApp\Models\Invoices;
1534+
*
1535+
* $invoice = Invoices::findFirst('inv_id = 4');
15341536
*
1535-
* $robot->update();
1537+
* $invoice->inv_total = 120;
1538+
*
1539+
* $invoice->update();
15361540
* ```
15371541
*
1542+
* !!! warning "NOTE"
1543+
*
1544+
* When retrieving the record with `findFirst()`, you need to get the full
1545+
* object back (no `columns` definition) but also retrieve it using the
1546+
* primary key. If not, the ORM will issue an `INSERT` instead of `UPDATE`.
1547+
*
15381548
* @return bool
15391549
*/
15401550
public function update(): bool

0 commit comments

Comments
 (0)