Browse Source

Fixed constructors.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
b7a7800fec
  1. 4
      framework/base/Action.php
  2. 4
      framework/base/ActionEvent.php
  3. 4
      framework/base/Application.php
  4. 4
      framework/base/Controller.php
  5. 4
      framework/base/Dictionary.php
  6. 4
      framework/base/Event.php
  7. 4
      framework/base/Model.php
  8. 4
      framework/base/Module.php
  9. 2
      framework/base/Request.php
  10. 37
      framework/base/Response.php
  11. 4
      framework/base/Vector.php
  12. 4
      framework/base/View.php
  13. 4
      framework/base/Widget.php
  14. 4
      framework/caching/ChainedDependency.php
  15. 4
      framework/caching/DbDependency.php
  16. 4
      framework/caching/ExpressionDependency.php
  17. 4
      framework/caching/FileDependency.php
  18. 17
      framework/console/Application.php
  19. 2
      framework/console/Request.php
  20. 3
      framework/db/ar/ActiveFinder.php
  21. 4
      framework/db/ar/ActiveQuery.php
  22. 3
      framework/db/ar/ActiveQueryBuilder.php
  23. 2
      framework/db/ar/JoinElement.php
  24. 4
      framework/db/dao/Command.php
  25. 4
      framework/db/dao/DataReader.php
  26. 4
      framework/db/dao/Driver.php
  27. 4
      framework/db/dao/Expression.php
  28. 4
      framework/db/dao/QueryBuilder.php
  29. 4
      framework/db/dao/Transaction.php
  30. 20
      framework/web/Application.php

4
framework/base/Action.php

@ -39,11 +39,13 @@ class Action extends Component
/**
* @param string $id the ID of this action
* @param Controller $controller the controller that owns this action
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($id, $controller)
public function __construct($id, $controller, $config = array())
{
$this->id = $id;
$this->controller = $controller;
parent::__construct($config);
}
/**

4
framework/base/ActionEvent.php

@ -32,9 +32,11 @@ class ActionEvent extends Event
/**
* Constructor.
* @param Action $action the action associated with this action event.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct(Action $action)
public function __construct(Action $action, $config = array())
{
$this->action = $action;
parent::__construct($config);
}
}

4
framework/base/Application.php

@ -121,14 +121,16 @@ class Application extends Module
* @param string $id the ID of this application. The ID should uniquely identify the application from others.
* @param string $basePath the base path of this application. This should point to
* the directory containing all application logic, template and data.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($id, $basePath)
public function __construct($id, $basePath, $config = array())
{
\Yii::$application = $this;
$this->id = $id;
$this->setBasePath($basePath);
$this->registerDefaultAliases();
$this->registerCoreComponents();
parent::__construct($config);
}
/**

4
framework/base/Controller.php

@ -78,11 +78,13 @@ class Controller extends Component
/**
* @param string $id ID of this controller
* @param Module $module the module that this controller belongs to.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($id, $module)
public function __construct($id, $module, $config = array())
{
$this->id = $id;
$this->module = $module;
parent::__construct($config);
}
/**

4
framework/base/Dictionary.php

@ -48,13 +48,15 @@ class Dictionary extends Object implements \IteratorAggregate, \ArrayAccess, \Co
* Initializes the dictionary with an array or an iterable object.
* @param mixed $data the initial data to be populated into the dictionary.
* This can be an array or an iterable object.
* @param array $config name-value pairs that will be used to initialize the object properties
* @throws Exception if data is not well formed (neither an array nor an iterable object)
*/
public function __construct($data = array())
public function __construct($data = array(), $config = array())
{
if ($data !== array()) {
$this->copyFrom($data);
}
parent::__construct($config);
}
/**

4
framework/base/Event.php

@ -49,10 +49,12 @@ class Event extends \yii\base\Object
*
* @param mixed $sender sender of the event
* @param mixed $data extra data associated with the event
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($sender = null, $data = null)
public function __construct($sender = null, $data = null, $config = array())
{
$this->sender = $sender;
$this->data = $data;
parent::__construct($config);
}
}

4
framework/base/Model.php

@ -54,10 +54,12 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
/**
* Constructor.
* @param string|null $scenario name of the [[scenario]] that this model is used in.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($scenario = null)
public function __construct($scenario = null, $config = array())
{
$this->_scenario = $scenario;
parent::__construct($config);
}
/**

4
framework/base/Module.php

@ -108,11 +108,13 @@ abstract class Module extends Component
* Constructor.
* @param string $id the ID of this module
* @param Module $parent the parent module (if any)
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($id, $parent = null)
public function __construct($id, $parent = null, $config = array())
{
$this->id = $id;
$this->module = $parent;
parent::__construct($config);
}
/**

2
framework/base/Request.php

@ -24,7 +24,7 @@ class Request extends ApplicationComponent
*/
public function getIsConsoleRequest()
{
return isset($this->_isConsoleRequest) ? $this->_isConsoleRequest : PHP_SAPI === 'cli';
return $this->_isConsoleRequest !== null ? $this->_isConsoleRequest : PHP_SAPI === 'cli';
}
/**

37
framework/base/Response.php

@ -1,6 +1,6 @@
<?php
/**
* Response and CCookieCollection class file.
* Response class file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright &copy; 2008-2012 Yii Software LLC
@ -10,11 +10,42 @@
namespace yii\base;
/**
* Response encapsulates the $_SERVER variable and resolves its inconsistency among different Web servers.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class Response extends ApplicationComponent
{
public function beginOutput()
{
ob_start();
ob_implicit_flush(false);
}
public function endOutput()
{
return ob_get_clean();
}
public function getOutput()
{
return ob_get_contents();
}
public function cleanOutput()
{
ob_clean();
}
public function removeOutput($all = true)
{
if ($all) {
for ($level = ob_get_level(); $level > 0; --$level) {
if (!@ob_end_clean()) {
ob_clean();
}
}
} else {
ob_end_clean();
}
}
}

4
framework/base/Vector.php

@ -55,13 +55,15 @@ class Vector extends Object implements \IteratorAggregate, \ArrayAccess, \Counta
* Initializes the vector with an array or an iterable object.
* @param mixed $data the initial data to be populated into the vector.
* This can be an array or an iterable object.
* @param array $config name-value pairs that will be used to initialize the object properties
* @throws Exception if data is not well formed (neither an array nor an iterable object)
*/
public function __construct($data = array())
public function __construct($data = array(), $config = array())
{
if ($data !== array()) {
$this->copyFrom($data);
}
parent::__construct($config);
}
/**

4
framework/base/View.php

@ -63,10 +63,12 @@ class View extends Component
/**
* Constructor.
* @param Controller|Widget|Object $context the context under which this view is being rendered (e.g. controller, widget)
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($context = null)
public function __construct($context = null, $config = array())
{
$this->context = $context;
parent::__construct($config);
}
public function render($view, $params = array())

4
framework/base/Widget.php

@ -33,10 +33,12 @@ class Widget extends Component
/**
* Constructor.
* @param Widget|Controller $owner owner/creator of this widget.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($owner)
public function __construct($owner, $config = array())
{
$this->owner = $owner;
parent::__construct($config);
}
/**

4
framework/caching/ChainedDependency.php

@ -42,10 +42,12 @@ class ChainedDependency extends Dependency
* @param array $dependencies list of dependencies that this dependency is composed of.
* Each array element should be a dependency object or a configuration array
* that can be used to create a dependency object via [[\Yii::createObject()]].
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($dependencies = array())
public function __construct($dependencies = array(), $config = array())
{
$this->dependencies = $dependencies;
parent::__construct($config);
}
/**

4
framework/caching/DbDependency.php

@ -41,10 +41,12 @@ class DbDependency extends Dependency
/**
* Constructor.
* @param Query $query the SQL query whose result is used to determine if the dependency has been changed.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($query = null)
public function __construct($query = null, $config = array())
{
$this->query = $query;
parent::__construct($config);
}
/**

4
framework/caching/ExpressionDependency.php

@ -29,10 +29,12 @@ class ExpressionDependency extends Dependency
/**
* Constructor.
* @param string $expression the PHP expression whose result is used to determine the dependency.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($expression = 'true')
public function __construct($expression = 'true', $config = array())
{
$this->expression = $expression;
parent::__construct($config);
}
/**

4
framework/caching/FileDependency.php

@ -29,10 +29,12 @@ class FileDependency extends Dependency
/**
* Constructor.
* @param string $fileName name of the file whose change is to be checked.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($fileName = null)
public function __construct($fileName = null, $config = array())
{
$this->fileName = $fileName;
parent::__construct($config);
}
/**

17
framework/console/Application.php

@ -135,4 +135,21 @@ class Application extends \yii\base\Application
'app' => 'yii\console\controllers\AppController',
);
}
/**
* Registers the core application components.
* @see setComponents
*/
public function registerCoreComponents()
{
parent::registerCoreComponents();
$this->setComponents(array(
'request' => array(
'class' => 'yii\console\Request',
),
'response' => array(
'class' => 'yii\console\Response',
),
));
}
}

2
framework/console/Request.php

@ -13,7 +13,7 @@ namespace yii\console;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class Request extends \yii\base\ApplicationComponent
class Request extends \yii\base\Request
{
/**
* @var string the controller route specified by this request. If this is an empty string,

3
framework/db/ar/ActiveFinder.php

@ -30,9 +30,10 @@ class ActiveFinder extends \yii\base\Object
*/
public $connection;
public function __construct($connection)
public function __construct($connection, $config = array())
{
$this->connection = $connection;
parent::__construct($config);
}
/**

4
framework/db/ar/ActiveQuery.php

@ -38,10 +38,12 @@ class ActiveQuery extends BaseActiveQuery implements \IteratorAggregate, \ArrayA
/**
* @param string $modelClass the name of the ActiveRecord class.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($modelClass)
public function __construct($modelClass, $config = array())
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
public function __call($name, $params)

3
framework/db/ar/ActiveQueryBuilder.php

@ -26,9 +26,10 @@ class ActiveQueryBuilder extends \yii\base\Object
*/
public $query;
public function __construct($query)
public function __construct($query, $config = array())
{
$this->query = $query;
parent::__construct($config);
}
public function build()

2
framework/db/ar/JoinElement.php

@ -15,7 +15,7 @@ use yii\db\dao\Query;
use yii\db\Exception;
class JoinElement extends \yii\base\Object
class JoinElement
{
/**
* @var integer ID of this join element

4
framework/db/dao/Command.php

@ -66,12 +66,14 @@ class Command extends \yii\base\Component
* @param Connection $connection the database connection
* @param string $sql the SQL statement to be executed
* @param array $params the parameters to be bound to the SQL statement
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($connection, $sql = null, $params = array())
public function __construct($connection, $sql = null, $params = array(), $config = array())
{
$this->connection = $connection;
$this->_sql = $sql;
$this->bindValues($params);
parent::__construct($config);
}
/**

4
framework/db/dao/DataReader.php

@ -52,11 +52,13 @@ class DataReader extends \yii\base\Object implements \Iterator, \Countable
/**
* Constructor.
* @param Command $command the command generating the query result
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct(Command $command)
public function __construct(Command $command, $config = array())
{
$this->_statement = $command->pdoStatement;
$this->_statement->setFetchMode(\PDO::FETCH_ASSOC);
parent::__construct($config);
}
/**

4
framework/db/dao/Driver.php

@ -71,10 +71,12 @@ abstract class Driver extends \yii\base\Object
/**
* Constructor.
* @param Connection $connection database connection.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($connection)
public function __construct($connection, $config = array())
{
$this->connection = $connection;
parent::__construct($config);
}
/**

4
framework/db/dao/Expression.php

@ -42,11 +42,13 @@ class Expression extends \yii\base\Object
* Constructor.
* @param string $expression the DB expression
* @param array $params parameters
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($expression, $params = array())
public function __construct($expression, $params = array(), $config = array())
{
$this->expression = $expression;
$this->params = $params;
parent::__construct($config);
}
/**

4
framework/db/dao/QueryBuilder.php

@ -49,10 +49,12 @@ class QueryBuilder extends \yii\base\Object
/**
* Constructor.
* @param Connection $connection the database connection.
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct($connection)
public function __construct($connection, $config = array())
{
$this->connection = $connection;
parent::__construct($config);
}
/**

4
framework/db/dao/Transaction.php

@ -49,12 +49,14 @@ class Transaction extends \yii\base\Object
/**
* Constructor.
* @param Connection $connection the connection associated with this transaction
* @param array $config name-value pairs that will be used to initialize the object properties
* @see Connection::beginTransaction
*/
public function __construct($connection)
public function __construct($connection, $config = array())
{
$this->active = true;
$this->connection = $connection;
parent::__construct($config);
}
/**

20
framework/web/Application.php

@ -31,4 +31,24 @@ class Application extends \yii\base\Application
{
return array();
}
/**
* Registers the core application components.
* @see setComponents
*/
public function registerCoreComponents()
{
parent::registerCoreComponents();
$this->setComponents(array(
'urlManager' => array(
'class' => 'yii\web\UrlManager',
),
'request' => array(
'class' => 'yii\web\Request',
),
'response' => array(
'class' => 'yii\web\Response',
),
));
}
}

Loading…
Cancel
Save