Cytat
Moje pytanie brzmi gdzie w kodzie ten doctrine jest użyty??
W tym przykładzie Doctrine używane jest w tym miejscu
namespace SanAuth\Model;
use Zend\Form\Annotation;
/**
* @Annotation\Hydrator("Zend\Stdlib\Hydrator\ObjectProperty")
* @Annotation\Name("User")
*/
class User
{
/**
* @Annotation\Type("Zend\Form\Element\Text")
* @Annotation\Required({"required":"true" })
* @Annotation\Filter({"name":"StripTags"})
* @Annotation\Options({"label":"Username:"})
*/
public $username;
/**
* @Annotation\Type("Zend\Form\Element\Password")
* @Annotation\Required({"required":"true" })
* @Annotation\Filter({"name":"StripTags"})
* @Annotation\Options({"label":"Password:"})
*/
public $password;
/**
* @Annotation\Type("Zend\Form\Element\Checkbox")
* @Annotation\Options({"label":"Remember Me ?:"})
*/
public $rememberme;
/**
* @Annotation\Type("Zend\Form\Element\Submit")
* @Annotation\Attributes({"value":"Submit"})
*/
public $submit;
}
Jeżeli miałeś wcześniej styczność z Doctrine to pewnie wiesz że pozwala na budowe tabel za pomocną adnotacji, które później są parsowane na odpowiednie wartości odpowiednich pól i generowany jest w ten sposób kod SQL. Zend framework 2 pozwala na budowe formularzy za pomocą adnotacji, wykorzystywany jest wtedy silnik doctrine to parsowania kodu. Tak też jest w tym przypadku, wszystko to co znajduje się w komentarzach parsowane jest na odpowiednie klasy, metody, wartości.
Więcej informacji na ten temat znajdziesz w dokumentacji
Zend Quick Start- Using AnnotationsWyszczególniony fragment:
Cytat
Form annotations require Doctrine\Common, which contains an annotation parsering engine