Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #246 from dereuromark/master-code-fixes

Master code fixes
  • Loading branch information...
commit b6f3bc07026161978deec72fa8371f63e91c087c 2 parents 00322e4 + 204bf5b
@markstory markstory authored
View
6 en/appendices/2-0-migration-guide.rst
@@ -232,7 +232,7 @@ Since settings have been moved to the component constructor, the
``initialize()`` callback no longer receives ``$settings`` as its 2nd parameter.
You should update your components to use the following method signature::
- function initialize($controller) { }
+ function initialize(Controller $controller) { }
Additionally, the initialize() method is only called on components that are
enabled. This usually means components that are directly attached to the
@@ -913,7 +913,7 @@ By default View objects contain a :php:class:`HelperCollection` at ``$this->Help
Themes
------
-To use themes in your Controller you no longer set ``var $view = 'Theme';``.
+To use themes in your Controller you no longer set ``public $view = 'Theme';``.
Use ``public $viewClass = 'Theme';`` instead.
Callback positioning changes
@@ -1166,7 +1166,7 @@ and models used within them. You must be explicit with the components, models,
and helpers you wish to use. In the past::
<?php
- var $components = array('Session', 'Comments');
+ public $components = array('Session', 'Comments');
Would look in the controller's plugin before checking app/core components. It
will now only look in the app/core components. If you wish to use objects from a
View
6 en/appendices/migrating-from-cakephp-1-2-to-1-3.rst
@@ -225,8 +225,8 @@ include these classes to retain existing behavior.
::
- var $components = array('Session', 'Auth', ...);
- var $helpers = array('Session', 'Html', 'Form' ...);
+ public $components = array('Session', 'Auth', ...);
+ public $helpers = array('Session', 'Html', 'Form' ...);
These change were done to make CakePHP more explicit and
declarative in what classes you the application developer want to
@@ -464,7 +464,7 @@ Model Databases and Datasources
- DataSource::exists() has been refactored to be more consistent
with non-database backed datasources. Previously, if you set
- ``var $useTable = false; var $useDbConfig = 'custom';``, it was
+ ``public $useTable = false; public $useDbConfig = 'custom';``, it was
impossible for ``Model::exists()`` to return anything but false.
This prevented custom datasources from using ``create()`` or
``update()`` correctly without some ugly hacks. If you have custom
View
10 en/appendices/new-features-in-cakephp-1-3.rst
@@ -26,7 +26,7 @@ settings for components when you declare the component.
::
- var $components = array(
+ public $components = array(
'Cookie' => array(
'name' => 'MyCookie'
),
@@ -178,7 +178,7 @@ could do:
::
- var $lastFm = array(
+ public $lastFm = array(
'datasource' => 'WebservicePack.LastFm'
...
@@ -240,7 +240,7 @@ schema file. Much like ``indexes``:
::
- var $comments => array(
+ public $comments => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'),
'post_id' => array('type' => 'integer', 'null' => false, 'default' => 0),
'comment' => array('type' => 'text'),
@@ -475,7 +475,7 @@ updated to allow the scaffolding of any one prefix.
Configure::write('Routing.prefixes', array('admin', 'member'));
class PostsController extends AppController {
- var $scaffold = 'member';
+ public $scaffold = 'member';
}
Would use scaffolding for member prefixed urls.
@@ -509,7 +509,7 @@ could use your NlValidation class by doing the following.
::
- var $validate = array(
+ public $validate = array(
'phone_no' => array('rule' => array('phone', null, 'nl')),
'postal_code' => array('rule' => array('postal', null, 'nl'))
);
View
2  en/appendices/new-features-in-cakephp-2-0.rst
@@ -103,7 +103,7 @@ flags. An example of a route class that supports subdomains would be::
<?php
class SubdomainRoute extends CakeRoute {
- public function match ($params) {
+ public function match($params) {
$subdomain = isset($params['subdomain']) ? $params['subdomain'] : null;
unset($params['subdomain']);
$path = parent::match($params);
View
4 en/controllers/components.rst
@@ -225,7 +225,7 @@ way you include them in controllers - using the ``$components`` var::
// the other component your component uses
public $components = array('Existing');
- public function initialize($controller) {
+ public function initialize(Controller $controller) {
$this->Existing->foo();
}
@@ -237,7 +237,7 @@ way you include them in controllers - using the ``$components`` var::
// app/Controller/Component/ExistingComponent.php
class ExistingComponent extends Component {
- public function initialize($controller) {
+ public function initialize(Controller $controller) {
$this->Parent->bar();
}
View
2  en/core-libraries/components/access-control-lists.rst
@@ -523,7 +523,7 @@ models to save data like we always do:
<?php
function any_action() {
- $aro =& $this->Acl->Aro;
+ $aro = $this->Acl->Aro;
// Here's all of our group info in an array we can iterate through
$groups = array(
View
2  en/core-libraries/components/request-handling.rst
@@ -49,7 +49,7 @@ the client and its request.
public $components = array('RequestHandler');
- public function beforeFilter () {
+ public function beforeFilter() {
if ($this->RequestHandler->accepts('html')) {
// Execute code only if client accepts an HTML (text/html) response
} elseif ($this->RequestHandler->accepts('xml')) {
View
2  en/development/exceptions.rst
@@ -304,7 +304,7 @@ or HTTP errors. An example use of the HTTP exceptions could be rendering 404
pages for items that have not been found::
<?php
- public function view ($id) {
+ public function view($id) {
$post = $this->Post->findById($id);
if (!$post) {
throw new NotFoundException('Could not find that post');
View
2  en/development/testing.rst
@@ -570,7 +570,7 @@ Let's now create a file named ``ArticleTest.php`` in your
<?php
App::uses('Article', 'Model');
- class ArticleTestCase extends CakeTestCase {
+ class ArticleTest extends CakeTestCase {
public $fixtures = array('app.article');
}
View
2  en/models/behaviors.rst
@@ -248,7 +248,7 @@ a mapped method is slightly different than a normal behavior mixin method::
class MyBehavior extends ModelBehavior {
public $mapMethods = array('/do(\w+)/' => 'doSomething');
- public function doSomething($model, $method, $arg1, $arg2) {
+ public function doSomething(Model $model, $method, $arg1, $arg2) {
debug(func_get_args());
//do something
}
View
2  en/views/helpers.rst
@@ -243,7 +243,7 @@ functionality that would be available to all helpers, create
App::uses('Helper', 'View');
class AppHelper extends Helper {
- public function customMethod () {
+ public function customMethod() {
}
}
View
4 en/views/media-view.rst
@@ -15,7 +15,7 @@ parameters to specify where your file is located::
<?php
class ExampleController extends AppController {
- public function download () {
+ public function download() {
$this->viewClass = 'Media';
// Download app/outside_webroot_dir/example.zip
$params = array(
@@ -34,7 +34,7 @@ MediaView's ``$mimeType`` array. We are also using a relative path which will
default to your ``app/webroot`` folder::
<?php
- public function download () {
+ public function download() {
$this->viewClass = 'Media';
// Render app/webroot/files/example.docx
$params = array(
View
6 ja/appendices/2-0-migration-guide.rst
@@ -217,7 +217,7 @@ Componentは、全てのコンポーネントが必須とする基底クラス
設定がコンポーネントのコンストラクタに移動したことで、 ``initialize()`` コールバックは2番目の引数に ``$settings`` を受け取らないようになりました。
以下のメソッド特性を使うようにコンポーネントを書き換える必要があります::
- function initialize($controller) { }
+ function initialize(Controller $controller) { }
加えて、initialize()メソッドはコンポーネントが有効な時のみ呼び出されます。
これは通常、コントローラに直接付随したコンポーネントを意味します。
@@ -842,7 +842,7 @@ View->Helpers
テーマ
------
-コントローラでテーマを使うには、 ``var $view = 'Theme';`` と指定しないようになりました。
+コントローラでテーマを使うには、 ``public $view = 'Theme';`` と指定しないようになりました。
代わりに ``public $viewClass = 'Theme';`` としてください。
コールバックの位置の変更
@@ -1069,7 +1069,7 @@ AclBehaviorとTreeBehavior
明示的に使いたいものを指定しなければなりません。以前は::
<?php
- var $components = array('Session', 'Comments');
+ public $components = array('Session', 'Comments');
とすると、アプリケーション・コアのコンポーネントをチェックする前にコントローラのプラグインを調べていたでしょう。
これはアプリケーション・コアのコンポーネントのみを見るようになりました。
View
6 ja/appendices/migrating-from-cakephp-1-2-to-1-3.rst
@@ -191,8 +191,8 @@ Sessionヘルパーと Sessionコンポーネントは他のコンポーネン
::
- var $components = array('Session', 'Auth', ...);
- var $helpers = array('Session', 'Html', 'Form' ...);
+ public $components = array('Session', 'Auth', ...);
+ public $helpers = array('Session', 'Html', 'Form' ...);
これらの変更はCakePHPが、これらクラスを明白的に、また宣言的にアプリケーション開発者が使いたいように成されました。
過去にはコアファイルを修正することなくセッションを読み込むのを避けることはできませんでした。
@@ -380,7 +380,7 @@ Cacheはエンジン毎のシングルトンの使用をやめ、代わりに ``
- DataSource::exists()は非DBデータソースも使えるように書き直されました。
- 以前は、 ``var $useTable = false; var $useDbConfig = 'custom';`` としても、 ``Model::exists()`` はfalse以外を返すことは不可能でした。
+ 以前は、 ``public $useTable = false; public $useDbConfig = 'custom';`` としても、 ``Model::exists()`` はfalse以外を返すことは不可能でした。
このことが ``create()`` または ``update()`` を使っているカスタムデータソースに醜いハックを用いずに正しく動作させることを妨げていました。
もしカスタムデータソースが ``create()````update()````read()`` ( ``Model::exists()`` がコールするであろう ``Model::find('count')`` は、 ``DataSource::read()`` に渡されるため)を実装しているなら、1.3上でユニットテストを再度走らせて確かめてください。
View
10 ja/appendices/new-features-in-cakephp-1-3.rst
@@ -23,7 +23,7 @@ Components
::
- var $components = array(
+ public $components = array(
'Cookie' => array(
'name' => 'MyCookie'
),
@@ -154,7 +154,7 @@ core.phpでこれらを設定しようとすると、正しく動作しないで
::
- var $lastFm = array(
+ public $lastFm = array(
'datasource' => 'WebservicePack.LastFm'
...
@@ -216,7 +216,7 @@ MySQLは一番多くのテーブルパラメータをサポートしています
::
- var $comments => array(
+ public $comments => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'),
'post_id' => array('type' => 'integer', 'null' => false, 'default' => 0),
'comment' => array('type' => 'text'),
@@ -418,7 +418,7 @@ error404に独自のエラーメソッドを変換したいなら、手動です
Configure::write('Routing.prefixes', array('admin', 'member'));
class PostsController extends AppController {
- var $scaffold = 'member';
+ public $scaffold = 'member';
}
これは「member」prefixがなされたURLでのスキャフォールディングを使うことになります。
@@ -446,7 +446,7 @@ error404に独自のエラーメソッドを変換したいなら、手動です
::
- var $validate = array(
+ public $validate = array(
'phone_no' => array('rule' => array('phone', null, 'nl')),
'postal_code' => array('rule' => array('postal', null, 'nl'))
);
View
2  ja/appendices/new-features-in-cakephp-2-0.rst
@@ -97,7 +97,7 @@ Router
<?php
class SubdomainRoute extends CakeRoute {
- public function match ($params) {
+ public function match($params) {
$subdomain = isset($params['subdomain']) ? $params['subdomain'] : null;
unset($params['subdomain']);
$path = parent::match($params);
View
4 pt/controllers/components.rst
@@ -197,7 +197,7 @@ em controllers, usando o atributo ``$components``::
// O outro componente que seu componente utiliza
public $components = array('Existing');
- function initialize($controller) {
+ function initialize(Controller $controller) {
$this->Existing->foo();
}
@@ -210,7 +210,7 @@ em controllers, usando o atributo ``$components``::
<?php
class ExistingComponent extends Component {
- function initialize($controller) {
+ function initialize(Controller $controller) {
$this->Parent->bar();
}
View
2  scripts/toc_extractor.php
@@ -25,7 +25,7 @@ function transformIndex(&$menu) {
}
}
-function transformMenu(&$menu){
+function transformMenu(&$menu) {
$dir = getcwd();
$html = file_get_contents("$dir/contents.html");
$html = preg_replace('/&(.+);/', '', $html);
Please sign in to comment.
Something went wrong with that request. Please try again.