Documentation

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).