Documentation
- 1 Getting started
- 2 Integrated fundamentals
- 3 Content store
- 3.1 Creating a document type
- 3.2 Integrated relations in code
- 3.3 Adding custom styles to editor
- 3.4 Adding menu items to the Integrated backend
- 3.5 Publication status of a content item
- 4 Blocks
- 5 Multi channel publishing
- 6 Storage
- 7 Themes and templating
- 8 Solr
- 9 Contributing
- 9 Social media
- 9 Users
3.1 Creating a document type
Before you start to create a new document, make sure you know the difference between content type and document type.
Create a new document
A new document can be created in a directory called Document in any Bundle, with a Doctrine ODM document. Extend this document from Integrated\Bundle\ContentBundle\Document\Content\Content or a document which extends from Content.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <?php /* * This file is part of the Integrated package. * * (c) e-Active B.V. <integrated@e-active.nl> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace AppBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; use Integrated\Common\Form\Mapping\Annotations as Type; use Integrated\Bundle\ContentBundle\Document\Content\Relation\Relation; /** * Document type Animal * * @ODM\Document * @Type\Document("Animal") */ class Animal extends Relation { } |
Adding fields
You can add extra fields in every ODM document, but you can also specify a field type to make the field available in Integrated:
Example:
1 2 3 4 5 6 | /** * @var string * @ODM\String * @Type\Field(type="integrated_tinymce") */ protected $species; |
and:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /** * Get the name of the document * * @return string */ public function getSpecies() { return $this->species; } /** * Set the name of the document * * @param string $name * @return $this */ public function setSpecies($species) { $this->species = $species; return $this; } } |
Adding a content type
After that you can add the content type in Integrated, by using the menu (Content types/Create new).