Skip to content

Instantly share code, notes, and snippets.

@Hounddog
Created October 22, 2015 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hounddog/a94e8d7847177150ba76 to your computer and use it in GitHub Desktop.
Save Hounddog/a94e8d7847177150ba76 to your computer and use it in GitHub Desktop.
'doctrine-hydrator' => array(
'product' => array(
'entity_class' => 'doctrine.entity',
'object_manager' => 'doctrine.entitymanager.orm_default',
'by_value' => true,
'hydrator' => 'Zend\\Stdlib\\Hydrator\\ArraySerializable',
'strategies' => array(
'category' => 'Application\Hydrator\EmbeddedEntityStrategy',
)
),
'product-category' => array(
'entity_class' => 'doctrine.entity',
'object_manager' => 'doctrine.entitymanager.orm_default',
'by_value' => false,
'hydrator' => 'Zend\\Stdlib\\Hydrator\\ArraySerializable',
'strategies' => array(
)
),
'router' => array(
'routes' => array(
'api.rest.product' => array(
'type' => 'Segment',
'options' => array(
'route' => '/api/product[/:product_id]',
'defaults' => array(
'controller' => 'Api\\V1\\Rest\\Product\\Controller',
),
),
'may_terminate' => true,
'child_routes' => array(
'category' => array(
'type' => 'Segment',
'options' => array(
'route' => '/category[/:category_id]',
),
),
)
),
'zf-hal' => array(
'renderer' => array(
'default_hydrator' => 'DoctrineModule\\Stdlib\\Hydrator\\DoctrineObject',
'display_embedded_resources' => false,
'render_embedded_resources' => false,
'render_embedded_entities' => false,
'render_collections' => true, // Collection Endpoints should be rendered
),
'metadata_map' => array(
'Application\\Entity\\Product' => array(
'entity_identifier_name' => 'id',
'route_name' => 'api.rest.product',
'route_identifier_name' => 'product_id',
'hydrator' => 'product'
),
'Application\\Entity\\ProductCategory' => array(
'entity_identifier_name' => 'id',
'route_name' => 'api.rest.product/category',
'route_identifier_name' => 'category_id',
'hydrator' => 'product-category',
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment