From c45af3cb38a2a3cf1d62ee673c981dd1d719d85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Cansado=20Sol=C3=A0?= Date: Sat, 25 Feb 2017 21:30:53 +0100 Subject: [PATCH 1/2] Update - 3.4 deprecated methods --- en/orm/table-objects.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/en/orm/table-objects.rst b/en/orm/table-objects.rst index d1564b2178..6a8df0d32e 100644 --- a/en/orm/table-objects.rst +++ b/en/orm/table-objects.rst @@ -36,7 +36,7 @@ Note that we did not tell the ORM which table to use for our class. By convention table objects will use a table that matches the lower cased and underscored version of the class name. In the above example the ``articles`` table will be used. If our table class was named ``BlogPosts`` your table should -be named ``blog_posts``. You can specify the table to using the ``table()`` +be named ``blog_posts``. You can specify the table to using the ``setTable()`` method:: namespace App\Model\Table; @@ -48,14 +48,14 @@ method:: public function initialize(array $config) { - $this->table('my_table'); + $this->setTable('my_table'); } } No inflection conventions will be applied when specifying a table. By convention the ORM also expects each table to have a primary key with the name of ``id``. -If you need to modify this you can use the ``primaryKey()`` method:: +If you need to modify this you can use the ``setPrimaryKey()`` method:: namespace App\Model\Table; @@ -65,7 +65,7 @@ If you need to modify this you can use the ``primaryKey()`` method:: { public function initialize(array $config) { - $this->primaryKey('my_id'); + $this->setPrimaryKey('my_id'); } } @@ -76,13 +76,13 @@ By default table objects use an entity class based on naming conventions. For example if your table class is called ``ArticlesTable`` the entity would be ``Article``. If the table class was ``PurchaseOrdersTable`` the entity would be ``PurchaseOrder``. If however, you want to use an entity that doesn't follow the -conventions you can use the ``entityClass()`` method to change things up:: +conventions you can use the ``setEntityClass()`` method to change things up:: class PurchaseOrdersTable extends Table { public function initialize(array $config) { - $this->entityClass('App\Model\Entity\PO'); + $this->setEntityClass('App\Model\Entity\PO'); } } From e0b574063ff17d6f49ec8b8c9471cc1a74c92539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Cansado=20Sol=C3=A0?= Date: Sun, 26 Feb 2017 19:38:20 +0100 Subject: [PATCH 2/2] add methods for pre 3.4 version --- en/orm/table-objects.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/en/orm/table-objects.rst b/en/orm/table-objects.rst index 6a8df0d32e..600f269afd 100644 --- a/en/orm/table-objects.rst +++ b/en/orm/table-objects.rst @@ -49,6 +49,9 @@ method:: public function initialize(array $config) { $this->setTable('my_table'); + + // Prior to 3.4.0 + $this->table('my_table'); } } @@ -66,6 +69,9 @@ If you need to modify this you can use the ``setPrimaryKey()`` method:: public function initialize(array $config) { $this->setPrimaryKey('my_id'); + + // Prior to 3.4.0 + $this->primaryKey('my_id'); } } @@ -83,6 +89,9 @@ conventions you can use the ``setEntityClass()`` method to change things up:: public function initialize(array $config) { $this->setEntityClass('App\Model\Entity\PO'); + + // Prior to 3.4.0 + $this->entityClass('App\Model\Entity\PO'); } }