New Doctrine2 Project
This tutorial shows how simple it is to start a new project using Skipper. We are going to create Doctrine2 ORM project with two bundles and four entities. Export of the created project to Doctrine2 .xml schema definition files is also part of this tutorial. We are also going to show the annotations export.
Hint: See the ORM Model basics for detailed description of the ORM elements (e.g. bundle, entity).
New project
First step is to create new project with Doctrine2 ORM framework support. Simply select the New ORM Project from File menu and do the following steps.






Application model design
Now we are going to design a simple application with two bundles and four entities. The first bundle will serve as contact records, the second bundle as an ecommerce logic. Contact bundle keeps data about customers and their addresses, Ecommerce bundle keeps data about orders and their items. Ecommerce order also has a relation with contact to store order owner. You can do it this way:














Export model
Now when you have created the application model, next step is to export it to Doctrine2 schema definition files. Before Skipper generates all the files for you, it is necessary to configure schema file destinations and export formats.
Skipper exports single schema file for each Doctrine2 entity. This means that our project will export four schema definition files (one for each entity in the model). Each bundle can have its own export path which is relative to project root directory and its own export format. For Doctrine2 ORM it is XML, YML and annotations.






And here is an example of Address entity. As you can see everything is well formatted and exported in Doctrine XML format.
<doctrine-mapping ...>
<entity name="Address">
<id name="id" type="integer">
<generator strategy="AUTO"/>
</id>
<field name="name" type="string" nullable="true"/>
<field name="street" type="string" nullable="true"/>
<field name="city" type="string" nullable="true"/>
<field name="postcode" type="string" nullable="true"/>
<field name="country" type="string" nullable="false"/>
<many-to-one field="Contact" target-entity="Contact" inversed-by="Address">
<join-columns>
<join-column name="contact_id" referenced-column-name="id" nullable="false"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
Skipper can export schema definitions to all supported Doctrine2 export formats - XML, YML or annotations. If you select annotations format export will look like this:
<?php
use Doctrine\ORM\Mapping AS ORM;
/**
* @ORM\Entity
*/
class Address
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $name;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $street;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $city;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $postcode;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $country;
/**
* @ORM\ManyToOne(targetEntity="Contact", inversedBy="Address")
* @ORM\JoinColumn(name="contact_id", referencedColumnName="id", nullable=false)
*/
private $Contact;
}
Conclusion
This short tutorial shows that to create new project and export it to schema definition files takes no more than five minutes in Skipper (if it is your first try, it may take little longer). Compare it with manual writing of such small project, and the acceleration of work is breathtaking. And in addition, you can concentrate only on the creative part of your work.