<?
/**
* @Document
* @InheritanceType("SINGLE_COLLECTION")
* @DiscriminatorField(fieldName="type")
* @DiscriminatorMap({"student"="Student","customer"="Customer"})
*/
class People {
/** @Id */
protected $id;
/** @String */
protected $name;
/** @String */
protected $surname;
..etc.. etc...
}
/**
* @Document
*/
class Student extend People {
/** @String */
protected $course;
/** @String */
protected $year;
..etc.. etc...
}
/**
* @Document
*/
class Customer extend People {
/** @String */
protected $code;
/** @String */
protected $name;
..etc.. etc...
}
/**
* @Document
*/
class MixedPeople {
/** @Id */
protected $id;
/** @ReferenceOne(targetDocument="People") */
protected $mixedpeople;
..etc.. etc...
}
Nessun commento:
Posta un commento