Skip to content

Commit

Permalink
[#14213] - Refactored Db/Mvc abstract classes
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Jul 1, 2019
1 parent 6da8f96 commit a4ff07c
Show file tree
Hide file tree
Showing 29 changed files with 129 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Db;
namespace Phalcon\Db\Dialect;

use Phalcon\Db\Exception;
use Phalcon\Db\ColumnInterface;

/**
* This is the base class to each database dialect. This implements
* common methods to transform intermediate code into its RDBMS related syntax
*/
abstract class Dialect implements DialectInterface
abstract class AbstractDialect implements DialectInterface
{
protected escapeChar;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Db;
namespace Phalcon\Db\Dialect;

use Phalcon\Db\ColumnInterface;
use Phalcon\Db\ReferenceInterface;
Expand Down
6 changes: 3 additions & 3 deletions phalcon/Db/Dialect/Mysql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

namespace Phalcon\Db\Dialect;

use Phalcon\Db\Dialect;
use Phalcon\Db\Dialect\AbstractDialect;
use Phalcon\Db\Column;
use Phalcon\Db\Exception;
use Phalcon\Db\IndexInterface;
use Phalcon\Db\ColumnInterface;
use Phalcon\Db\ReferenceInterface;
use Phalcon\Db\DialectInterface;
use Phalcon\Db\Dialect\DialectInterface;

/**
* Generates database specific SQL for the MySQL RDBMS
*/
class Mysql extends Dialect
class Mysql extends AbstractDialect
{
/**
* @var string
Expand Down
8 changes: 4 additions & 4 deletions phalcon/Db/Dialect/Postgresql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

namespace Phalcon\Db\Dialect;

use Phalcon\Db\Dialect;
use Phalcon\Db\Column;
use Phalcon\Db\ColumnInterface;
use Phalcon\Db\Dialect\AbstractDialect;
use Phalcon\Db\Dialect\DialectInterface;
use Phalcon\Db\Exception;
use Phalcon\Db\IndexInterface;
use Phalcon\Db\ColumnInterface;
use Phalcon\Db\ReferenceInterface;
use Phalcon\Db\DialectInterface;

/**
* Generates database specific SQL for the PostgreSQL RDBMS
*/
class Postgresql extends Dialect
class Postgresql extends AbstractDialect
{
/**
* @var string
Expand Down
6 changes: 3 additions & 3 deletions phalcon/Db/Dialect/Sqlite.zep
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ namespace Phalcon\Db\Dialect;
use Phalcon\Db\Column;
use Phalcon\Db\Exception;
use Phalcon\Db\IndexInterface;
use Phalcon\Db\Dialect;
use Phalcon\Db\DialectInterface;
use Phalcon\Db\Dialect\AbstractDialect;
use Phalcon\Db\Dialect\DialectInterface;
use Phalcon\Db\ColumnInterface;
use Phalcon\Db\ReferenceInterface;

/**
* Generates database specific SQL for the SQLite RDBMS
*/
class Sqlite extends Dialect
class Sqlite extends AbstractDialect
{
/**
* @var string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Mvc;
namespace Phalcon\Mvc\Controller;

use Phalcon\Di\Injectable;

/**
* Phalcon\Mvc\Controller
*
* Every application controller should extend this class that encapsulates all
* the controller functionality
*
Expand All @@ -26,7 +24,7 @@ use Phalcon\Di\Injectable;
*```php
* <?php
*
* class PeopleController extends \Phalcon\Mvc\Controller
* class PeopleController extends \Phalcon\Mvc\Controller\AbstractController
* {
* // This action will be executed by default
* public function indexAction()
Expand All @@ -52,10 +50,10 @@ use Phalcon\Di\Injectable;
* }
*```
*/
abstract class Controller extends Injectable implements ControllerInterface
abstract class AbstractController extends Injectable implements ControllerInterface
{
/**
* Phalcon\Mvc\Controller constructor
* Phalcon\Mvc\Controller\AbstractController constructor
*/
final public function __construct()
{
Expand Down
4 changes: 1 addition & 3 deletions phalcon/Mvc/Controller/BindModelInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
namespace Phalcon\Mvc\Controller;

/**
* Phalcon\Mvc\Controller\BindModelInterface
*
* Interface for Phalcon\Mvc\Controller
*Interface for Phalcon\Mvc\Controller\BindModel
*/
interface BindModelInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Mvc;
namespace Phalcon\Mvc\Controller;

/**
* Phalcon\Mvc\ControllerInterface
*
* Interface for controller handlers
*/
interface ControllerInterface
Expand Down
2 changes: 1 addition & 1 deletion phalcon/Mvc/Dispatcher.zep
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use Phalcon\Mvc\DispatcherInterface;
use Phalcon\Mvc\Dispatcher\Exception;
use Phalcon\Events\ManagerInterface;
use Phalcon\Http\ResponseInterface;
use Phalcon\Mvc\ControllerInterface;
use Phalcon\Mvc\Controller\ControllerInterface;
use Phalcon\Dispatcher\AbstractDispatcher as BaseDispatcher;

/**
Expand Down
2 changes: 1 addition & 1 deletion phalcon/Mvc/DispatcherInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Phalcon\Mvc;

use Phalcon\Mvc\ControllerInterface;
use Phalcon\Mvc\Controller\ControllerInterface;
use Phalcon\Dispatcher\DispatcherInterface as DispatcherInterfaceBase;

/**
Expand Down
4 changes: 2 additions & 2 deletions phalcon/Mvc/Micro.zep
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use ArrayAccess;
use Closure;
use Phalcon\DiInterface;
use Phalcon\Di\Injectable;
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Controller\AbstractController;
use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\Micro\Exception;
use Phalcon\Di\ServiceInterface;
Expand Down Expand Up @@ -474,7 +474,7 @@ class Micro extends Injectable implements ArrayAccess
if typeof handler == "array" {
let realHandler = handler[0];

if realHandler instanceof Controller && modelBinder != null {
if realHandler instanceof AbstractController && modelBinder != null {
let methodName = handler[1];
let bindCacheKey = "_PHMB_" . get_class(realHandler) . "_" . methodName;

Expand Down
6 changes: 3 additions & 3 deletions phalcon/Mvc/Model.zep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Phalcon\Mvc;
use JsonSerializable;
use Phalcon\Db\Adapter\AdapterInterface;
use Phalcon\Db\Column;
use Phalcon\Db\DialectInterface;
use Phalcon\Db\Dialect\DialectInterface;
use Phalcon\Db\Enum;
use Phalcon\Db\RawValue;
use Phalcon\Di\InjectionAwareInterface;
Expand All @@ -22,12 +22,12 @@ use Phalcon\Events\ManagerInterface as EventsManagerInterface;
use Phalcon\Helper\Arr;
use Phalcon\Messages\Message;
use Phalcon\Messages\MessageInterface;
use Phalcon\Mvc\Model\BehaviorInterface;
use Phalcon\Mvc\Model\Behavior\BehaviorInterface;
use Phalcon\Mvc\Model\Criteria;
use Phalcon\Mvc\Model\CriteriaInterface;
use Phalcon\Mvc\Model\Exception;
use Phalcon\Mvc\Model\ManagerInterface;
use Phalcon\Mvc\Model\MetaDataInterface;
use Phalcon\Mvc\Model\MetaData\MetaDataInterface;
use Phalcon\Mvc\Model\Query;
use Phalcon\Mvc\Model\Query\Builder;
use Phalcon\Mvc\Model\Query\BuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Mvc\Model;
namespace Phalcon\Mvc\Model\Behavior;

use Phalcon\Mvc\ModelInterface;
use Phalcon\Mvc\Model\BehaviorInterface;
use Phalcon\Mvc\Model\Behavior\BehaviorInterface;

/**
* Phalcon\Mvc\Model\Behavior
*
* This is an optional base class for ORM behaviors
*/
abstract class Behavior implements BehaviorInterface
abstract class AbstractBehavior implements BehaviorInterface
{
/**
* @var array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
* file that was distributed with this source code.
*/

namespace Phalcon\Mvc\Model;
namespace Phalcon\Mvc\Model\Behavior;

use Phalcon\Mvc\ModelInterface;

/**
* Phalcon\Mvc\Model\BehaviorInterface
*
* Interface for Phalcon\Mvc\Model\Behavior
*/
interface BehaviorInterface
Expand Down
4 changes: 2 additions & 2 deletions phalcon/Mvc/Model/Behavior/SoftDelete.zep
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Phalcon\Mvc\Model\Behavior;

use Phalcon\Mvc\ModelInterface;
use Phalcon\Mvc\Model\Behavior;
use Phalcon\Mvc\Model\Behavior\AbstractBehavior;
use Phalcon\Mvc\Model\Exception;

/**
Expand All @@ -20,7 +20,7 @@ use Phalcon\Mvc\Model\Exception;
* Instead of permanently delete a record it marks the record as deleted
* changing the value of a flag column
*/
class SoftDelete extends Behavior
class SoftDelete extends AbstractBehavior
{
/**
* Listens for notifications from the models manager
Expand Down
4 changes: 2 additions & 2 deletions phalcon/Mvc/Model/Behavior/Timestampable.zep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Phalcon\Mvc\Model\Behavior;

use Closure;
use Phalcon\Mvc\ModelInterface;
use Phalcon\Mvc\Model\Behavior;
use Phalcon\Mvc\Model\Behavior\AbstractBehavior;
use Phalcon\Mvc\Model\Exception;

/**
Expand All @@ -21,7 +21,7 @@ use Phalcon\Mvc\Model\Exception;
* Allows to automatically update a model’s attribute saving the datetime when a
* record is created or updated
*/
class Timestampable extends Behavior
class Timestampable extends AbstractBehavior
{
/**
* Listens for notifications from the models manager
Expand Down
2 changes: 1 addition & 1 deletion phalcon/Mvc/Model/Manager.zep
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use Phalcon\Mvc\Model\Query;
use Phalcon\Mvc\Model\QueryInterface;
use Phalcon\Mvc\Model\Query\Builder;
use Phalcon\Mvc\Model\Query\BuilderInterface;
use Phalcon\Mvc\Model\BehaviorInterface;
use Phalcon\Mvc\Model\Behavior\BehaviorInterface;
use Phalcon\Events\ManagerInterface as EventsManagerInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion phalcon/Mvc/Model/ManagerInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Phalcon\Mvc\Model;

use Phalcon\Db\Adapter\AdapterInterface;
use Phalcon\Mvc\ModelInterface;
use Phalcon\Mvc\Model\BehaviorInterface;
use Phalcon\Mvc\Model\Behavior\BehaviorInterface;
use Phalcon\Mvc\Model\RelationInterface;
use Phalcon\Mvc\Model\Query\BuilderInterface;
use Phalcon\Mvc\Model\QueryInterface;
Expand Down
Loading

0 comments on commit a4ff07c

Please sign in to comment.