Skip to content

Commit

Permalink
Merge pull request #96 from niden/master
Browse files Browse the repository at this point in the history
5.6.0
  • Loading branch information
niden authored Jan 9, 2024
2 parents 6e3c59e + 2d4e124 commit 0593372
Show file tree
Hide file tree
Showing 16 changed files with 365 additions and 163 deletions.
76 changes: 75 additions & 1 deletion src/DataMapper/Query/AbstractQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,82 @@ public function quoteIdentifier(string $name, int $type = \PDO::PARAM_STR): stri

/**
* Resets the internal array
*
* @return void
*/
public function reset(): void
{
}

/**
* Resets the columns
*
* @return void
*/
public function resetColumns(): void
{
}

/**
* Resets the from
*
* @return void
*/
public function resetFrom(): void
{
}

/**
* Resets the where
*
* @return void
*/
public function resetWhere(): void
{
}

/**
* Resets the group by
*
* @return void
*/
public function resetGroupBy(): void
{
}

/**
* Resets the having
*
* @return void
*/
public function resetHaving(): void
{
}

/**
* Resets the order by
*
* @return void
*/
public function resetOrderBy(): void
{
}

/**
* Resets the limit and offset
*
* @return void
*/
public function resetLimit(): void
{
}

/**
* Resets the flags
*
* @return void
*/
public function reset()
public function resetFlags(): void
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/DataMapper/Query/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ public function orHaving(string $condition, $value = null, int $type = -1): Sele
/**
* Resets the internal collections
*
* @return Select
* @return void
*/
public function reset(): Select
public function reset(): void
{
}

Expand Down
68 changes: 0 additions & 68 deletions src/Db/AbstractDb.php

This file was deleted.

54 changes: 53 additions & 1 deletion src/Db/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,49 @@
use Phalcon\Events\ManagerInterface;

/**
* Base class for Phalcon\Db\Adapter adapters
* Base class for Phalcon\Db\Adapter adapters.
*
* This class and its related classes provide a simple SQL database interface
* for Phalcon Framework. The Phalcon\Db is the basic class you use to connect
* your PHP application to an RDBMS. There is a different adapter class for each
* brand of RDBMS.
*
* This component is intended to lower level database operations. If you want to
* interact with databases using higher level of abstraction use
* Phalcon\Mvc\Model.
*
* Phalcon\Db\AbstractDb is an abstract class. You only can use it with a
* database adapter like Phalcon\Db\Adapter\Pdo
*
* ```php
* use Phalcon\Db;
* use Phalcon\Db\Exception;
* use Phalcon\Db\Adapter\Pdo\Mysql as MysqlConnection;
*
* try {
* $connection = new MysqlConnection(
* [
* "host" => "192.168.0.11",
* "username" => "sigma",
* "password" => "secret",
* "dbname" => "blog",
* "port" => "3306",
* ]
* );
*
* $result = $connection->query(
* "SELECT FROM co_invoices LIMIT 5"
* );
*
* $result->setFetchMode(Enum::FETCH_NUM);
*
* while ($invoice = $result->fetch()) {
* print_r($invoice);
* }
* } catch (Exception $e) {
* echo $e->getMessage(), PHP_EOL;
* }
* ```
*/
abstract class AbstractAdapter implements \Phalcon\Db\Adapter\AdapterInterface, \Phalcon\Events\EventsAwareInterface
{
Expand Down Expand Up @@ -808,6 +850,16 @@ public function setNestedTransactionsWithSavepoints(bool $nestedTransactionsWith
{
}

/**
* Enables/disables options in the Database component
*
* @param array $options
* @return void
*/
public static function setup(array $options): void
{
}

/**
* Returns a SQL modified with a LOCK IN SHARE MODE clause
*
Expand Down
19 changes: 0 additions & 19 deletions src/Db/Adapter/Pdo/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,6 @@ class Mysql extends \Phalcon\Db\Adapter\Pdo\AbstractPdo
*/
protected $type = 'mysql';

/**
* Constructor for Phalcon\Db\Adapter\Pdo
*
* @param array $descriptor = [
* 'host' => 'localhost',
* 'port' => '3306',
* 'dbname' => 'blog',
* 'username' => 'sigma'
* 'password' => 'secret'
* 'dialectClass' => null,
* 'options' => [],
* 'dsn' => null,
* 'charset' => 'utf8mb4'
* ]
*/
public function __construct(array $descriptor)
{
}

/**
* Adds a foreign key to a table
*
Expand Down
4 changes: 2 additions & 2 deletions src/Di/Di.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected function loadFromConfig(\Phalcon\Config\ConfigInterface $config): void
* ];
* ```
*
* @link https://docs.phalcon.io/en/latest/reference/di.html
* @link https://docs.phalcon.io/latest/di/
* @param string $filePath
* @return void
*/
Expand Down Expand Up @@ -271,7 +271,7 @@ public function loadFromPhp(string $filePath): void
* className: \Acme\User
* ```
*
* @link https://docs.phalcon.io/en/latest/reference/di.html
* @link https://docs.phalcon.io/latest/di/
* @param string $filePath
* @param array $callbacks
* @return void
Expand Down
10 changes: 5 additions & 5 deletions src/Filter/Validation/Validator/Uniqueness.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ class Uniqueness extends AbstractCombinedFieldsValidator
* Constructor
*
* @param array $options = [
* 'message' => '',
* 'template' => '',
* 'message' => '',
* 'template' => '',
* 'allowEmpty' => false,
* 'convert' => null,
* 'model' => null,
* 'except' => null
* 'convert' => null,
* 'model' => null,
* 'except' => null
* ]
*/
public function __construct(array $options = [])
Expand Down
4 changes: 0 additions & 4 deletions src/Html/Helper/Input/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

/**
* Class Select
*
* @property string $elementTag
* @property bool $inOptGroup
* @property string $selected
*/
class Select extends AbstractList
{
Expand Down
24 changes: 17 additions & 7 deletions src/Mvc/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1515,26 +1515,36 @@ public static function sum($parameters = null): ResultsetInterface|float
* ```
*
* @param array $columns
* @param mixed $useGetter
* @return array
*/
public function toArray($columns = null): array
public function toArray($columns = null, $useGetter = true): array
{
}

/**
* Updates a model instance. If the instance doesn't exist in the
* persistence it will throw an exception. Returning true on success or
* false otherwise.
* persistence it will throw an exception. Returning `true` on success or
* `false` otherwise.
*
* ```php
* // Updating a robot name
* $robot = Robots::findFirst("id = 100");
* <?php
*
* $robot->name = "Biomass";
* use MyApp\Models\Invoices;
*
* $invoice = Invoices::findFirst('inv_id = 4');
*
* $robot->update();
* $invoice->inv_total = 120;
*
* $invoice->update();
* ```
*
* !!! warning "NOTE"
*
* When retrieving the record with `findFirst()`, you need to get the full
* object back (no `columns` definition) but also retrieve it using the
* primary key. If not, the ORM will issue an `INSERT` instead of `UPDATE`.
*
* @return bool
*/
public function update(): bool
Expand Down
Loading

0 comments on commit 0593372

Please sign in to comment.