Skip to content

Annotations and Parameters

sweiguny edited this page Aug 27, 2014 · 1 revision

Annotations are the heart of PPA. Annotations are supposed to set up the configuration of your entities. Basically, you can annotate each class that extends \PPA\core\Entity and each of its properties.

For a complete list of annotations look here.

Syntax specification:
  • Every annotation begins with an @ and can have multiple parameters.
  • The parameters are defined within the parentheses of the annotation and are separated with ,.
  • The value of the parameter must be assigned with = and enclosed with ' or ". It does not matter how many whitespace-characters are between the parentheses and the equal-sign. But the value within the quotes is taken AS-IS.
  • All annotations are completely case-insensitive, exceptionally the mappedBy parameter value.
  • That PPA can parse the annotations correctly, it is important to put each annotation in a separate line.

Note:

  • Table and column names are interpreted as lower-case.

Examples:

/**
 * Example of correct annotations.
 *
 * @id
 * @column(name="id", <param-name>='<param-value>')
 */
private $id;
/** Example of wrong annotation - must be in a separate line. @column(name='id') */
private $password;
/**
 * This is also correct.
 * The case does not matter. The number of whitespaces does not matter as well.
 * @COLUMN (   NAME  =  'usrnam')
 */
public $username
Clone this wiki locally