for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Khepin\Fixture\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ODM\Document
*/
class Article
{
* @ODM\Id
private $id;
* @ODM\String
private $title;
* @ODM\EmbedOne(targetDocument="Author")
private $author;
* @ODM\EmbedMany(targetDocument="Tag")
private $tags;
* @var type
private $content;
public function __construct()
$this->comments = new ArrayCollection;
comments
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
public function getId()
return $this->id;
public function getTitle()
return $this->title;
public function setTitle($title)
$this->title = $title;
public function getContent()
return $this->content;
public function setContent($content)
$this->content = $content;
public function getAuthor()
return $this->author;
public function setAuthor(Author $author)
$this->author = $author;
public function getTags()
return $this->tags;
public function addTags(Tag $tag)
$this->tags[] = $tag;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: