1
0
mirror of synced 2025-02-21 14:43:14 +03:00

Rename getting-started tutorial page.

This commit is contained in:
Benjamin Eberlei 2012-01-29 19:48:09 +01:00
parent 0b7d5f2813
commit 5e3e48c8dd
2 changed files with 37 additions and 19 deletions

View File

@ -26,7 +26,7 @@ Getting Started
--------------- ---------------
* **Tutorial**: * **Tutorial**:
:doc:`Getting Started <tutorials/getting-started-xml-edition>` :doc:`Getting Started <tutorials/getting-started>`
* **Reference**: * **Reference**:
:doc:`Introduction <reference/introduction>` | :doc:`Introduction <reference/introduction>` |

View File

@ -135,6 +135,7 @@ following set of classes. Put them into `entities/Bug.php`,
} }
.. code-block:: php .. code-block:: php
// User.php // User.php
class User class User
{ {
@ -207,6 +208,8 @@ with the assumptions about related collections:
class Bug class Bug
{ {
// ... (previous code)
protected $products = null; protected $products = null;
public function __construct() public function __construct()
@ -222,6 +225,8 @@ with the assumptions about related collections:
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
class User class User
{ {
// ... (previous code)
protected $reportedBugs = null; protected $reportedBugs = null;
protected $assignedBugs = null; protected $assignedBugs = null;
@ -298,6 +303,8 @@ the bi-directional reference:
// entities/Bug.php // entities/Bug.php
class Bug class Bug
{ {
// ... (previous code)
protected $engineer; protected $engineer;
protected $reporter; protected $reporter;
@ -330,6 +337,8 @@ the bi-directional reference:
// entities/User.php // entities/User.php
class User class User
{ {
// ... (previous code)
protected $reportedBugs = null; protected $reportedBugs = null;
protected $assignedBugs = null; protected $assignedBugs = null;
@ -383,6 +392,8 @@ the database that points from Bugs to Products.
// entities/Bug.php // entities/Bug.php
class Bug class Bug
{ {
// ... (previous code)
protected $products = null; protected $products = null;
public function assignToProduct($product) public function assignToProduct($product)
@ -450,13 +461,15 @@ the most simple one:
// entities/Product.php // entities/Product.php
/** /**
* @Entity @Table(name="products") * @Entity @Table(name="products")
*/ **/
class Product class Product
{ {
/** @Id @Column(type="integer") @GeneratedValue */ /** @Id @Column(type="integer") @GeneratedValue **/
protected $id; protected $id;
/** @Column(type="string") */ /** @Column(type="string") **/
protected $name; protected $name;
// .. (other code)
} }
.. code-block:: xml .. code-block:: xml
@ -509,40 +522,42 @@ We then go on specifying the definition of a Bug:
// entities/Bug.php // entities/Bug.php
/** /**
* @Entity @Table(name="bugs") * @Entity @Table(name="bugs")
*/ **/
class Bug class Bug
{ {
/** /**
* @Id @Column(type="integer") @GeneratedValue * @Id @Column(type="integer") @GeneratedValue
*/ **/
protected $id; protected $id;
/** /**
* @Column(type="string") * @Column(type="string")
*/ **/
protected $description; protected $description;
/** /**
* @Column(type="datetime") * @Column(type="datetime")
*/ **/
protected $created; protected $created;
/** /**
* @Column(type="string") * @Column(type="string")
*/ **/
protected $status; protected $status;
/** /**
* @ManyToOne(targetEntity="User", inversedBy="assignedBugs") * @ManyToOne(targetEntity="User", inversedBy="assignedBugs")
*/ **/
protected $engineer; protected $engineer;
/** /**
* @ManyToOne(targetEntity="User", inversedBy="reportedBugs") * @ManyToOne(targetEntity="User", inversedBy="reportedBugs")
*/ **/
protected $reporter; protected $reporter;
/** /**
* @ManyToMany(targetEntity="Product") * @ManyToMany(targetEntity="Product")
*/ **/
protected $products; protected $products;
// ... (other code)
} }
.. code-block:: xml .. code-block:: xml
@ -637,33 +652,36 @@ The last missing definition is that of the User entity:
// entities/User.php // entities/User.php
/** /**
* @Entity @Table(name="users") * @Entity @Table(name="users")
*/ **/
class User class User
{ {
/** /**
* @Id @GeneratedValue @Column(type="integer") * @Id @GeneratedValue @Column(type="integer")
* @var int * @var int
*/ **/
protected $id; protected $id;
/** /**
* @Column(type="string") * @Column(type="string")
* @var string * @var string
*/ **/
protected $name; protected $name;
/** /**
* @OneToMany(targetEntity="Bug", mappedBy="reporter") * @OneToMany(targetEntity="Bug", mappedBy="reporter")
* @var Bug[] * @var Bug[]
*/ **/
protected $reportedBugs = null; protected $reportedBugs = null;
/** /**
* @OneToMany(targetEntity="Bug", mappedBy="engineer") * @OneToMany(targetEntity="Bug", mappedBy="engineer")
* @var Bug[] * @var Bug[]
*/ **/
protected $assignedBugs = null; protected $assignedBugs = null;
// .. (other code)
}
.. code-block:: xml .. code-block:: xml
<!-- config/xml/User.dcm.xml --> <!-- config/xml/User.dcm.xml -->
@ -1161,7 +1179,7 @@ looks like:
/** /**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE. * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/ **/
class UserProxy extends \User implements \Doctrine\ORM\Proxy\Proxy class UserProxy extends \User implements \Doctrine\ORM\Proxy\Proxy
{ {
// .. lazy load code here // .. lazy load code here
@ -1411,7 +1429,7 @@ we have to adjust the metadata slightly.
/** /**
* @Entity(repositoryClass="BugRepository") * @Entity(repositoryClass="BugRepository")
* @Table(name="bugs") * @Table(name="bugs")
*/ **/
class Bug class Bug
{ {
//... //...