Annotations are more than PHPDoc comments, they’re a fully-featured way of including additional information alongside your code. We might have rejected an RFC to add support into the PHP core, but the community has embraced this tool anyway!
This session shows you who is doing what with annotations, and will give you some ideas on how to use the existing tools in your own projects to keep life simple. Developers, architects and anyone responsible for the technical direction of an application should attend this session.
37. “Annotations do not directly affect program
semantics”
-- In Code Speak --
“An annotation is metadata attached to your
code, that can be read at runtime.”
38. “Annotations do not directly affect program
semantics”
-- In Code Speak --
“An annotation is metadata attached to your
code, that can be read at runtime.”
effects
682. Service
09:00 - DIC wake-up call
09:05 - Reply to emergency filter call
09:06 - Get Annotations for properties
09:07 - Track down the Filters
new FilterService($reader);
$service-filter($object);
$reader-getPropertyAnnotations($p);
$a = array(StripTags(), Alpha());
new FiltersStripTags();
688. Service
09:00 - DIC wake-up call
09:05 - Reply to emergency filter call
09:06 - Get Annotations for properties
09:07 - Track down the Filters
09:08 - Get values filtered
new FilterService($reader);
$service-filter($object);
$reader-getPropertyAnnotations($p);
$a = array(StripTags(), Alpha());
new FiltersStripTags();
$filter-apply($rule, $value);
694. Service
09:00 - DIC wake-up call
09:05 - Reply to emergency filter call
09:06 - Get Annotations for properties
09:07 - Track down the Filters
09:08 - Get values filtered
09:10 - Update the object with new data
new FilterService($reader);
$service-filter($object);
$reader-getPropertyAnnotations($p);
$a = array(StripTags(), Alpha());
new FiltersStripTags();
$filter-apply($rule, $value);
$object-prop = $newValue;
700. Service
09:00 - DIC wake-up call
09:05 - Reply to emergency filter call
09:06 - Get Annotations for properties
09:07 - Track down the Filters
09:08 - Get values filtered
09:10 - Update the object with new data
09:11 - send the object on its way
new FilterService($reader);
$service-filter($object);
$reader-getPropertyAnnotations($p);
$a = array(StripTags(), Alpha());
new FiltersStripTags();
$filter-apply($rule, $value);
$object-prop = $newValue;
return $object;
706. Service
09:00 - DIC wake-up call
09:05 - Reply to emergency filter call
09:06 - Get Annotations for properties
09:07 - Track down the Filters
09:08 - Get values filtered
09:10 - Update the object with new data
09:11 - send the object on its way
new FilterService($reader);
$service-filter($object);
$reader-getPropertyAnnotations($p);
$a = array(StripTags(), Alpha());
new FiltersStripTags();
$filter-apply($rule, $value);
$object-prop = $newValue;
return $object;
09:12 - DO IT ALL AGAIN!
712. Service
09:00 - DIC wake-up call
09:05 - Reply to emergency filter call
09:06 - Get Annotations for properties
09:07 - Track down the Filters
09:08 - Get values filtered
09:10 - Update the object with new data
09:11 - send the object on its way
new FilterService($reader);
$service-filter($object);
$reader-getPropertyAnnotations($p);
$a = array(StripTags(), Alpha());
new FiltersStripTags();
$filter-apply($rule, $value);
$object-prop = $newValue;
return $object;
09:12 - DO IT ALL AGAIN!
713. //Iterate over all annotations !
foreach($this-reader-getPropertyAnnotations($property) as $rule) { !
!
//Skip is its not a rule !
if ( ! $rule instanceof RulesRule ) continue; !
!
//Add Rule !
$metadata-addPropertyRule($property-getName(), $rule); !
!
}
714. //Iterate over all annotations !
foreach($this-reader-getPropertyAnnotations($property) as $rule) { !
!
//Skip is its not a rule !
if ( ! $rule instanceof RulesRule ) continue; !
!
//Add Rule !
$metadata-addPropertyRule($property-getName(), $rule); !
!
}
get
718. //Iterate over all annotations !
foreach($this-reader-getPropertyAnnotations($property) as $rule) { !
!
//Skip is its not a rule !
if ( ! $rule instanceof RulesRule ) continue; !
!
//Add Rule !
$metadata-addPropertyRule($property-getName(), $rule); !
!
}
get
725. //Iterate over all annotations !
foreach($this-reader-getPropertyAnnotations($property) as $rule) { !
!
//Skip is its not a rule !
if ( ! $rule instanceof RulesRule ) continue; !
!
//Add Rule !
$metadata-addPropertyRule($property-getName(), $rule); !
!
}
glorified