Componette

Componette

deprecated-packages

deprecated-packages / DoctrineMethodsHydrator v5.1.0

[DEPRECATED] use arachne/entity-loader instead

download-cloud-line composer require zenify/doctrine-methods-hydrator

Doctrine Methods Hydrator

Build Status Quality Score Code Coverage Downloads Latest stable

Install

$ composer require zenify/doctrine-methods-hydrator

Register the extension in config.neon:

extensions:
	- Zenify\DoctrineMethodsHydrator\DI\MethodsHydratorExtension
	
	# Kdyby\Doctrine or another Doctrine to Nette implementation

The goal of this extension is to enhance native tryCall method of Control to hydrate parameters of called methods. All render*, action* and handle* methods are hydrated, if entity class typehint is present if args definition.

Usage

Use in presenter looks like this:

class Presenter extends Nette\Application\UI\Presenter
{

	/**
	 * @inject
   	 * @var Zenify\DoctrineMethodsHydrator\Contract\MethodsHydratorInterface
   	 */
   	public $methodsHydrator;


	/**
	 * @param string $method
	 * @param array $parameters
	 * @return bool
	 */
	protected function tryCall($method, array $parameters)
	{
		return $this->methodsHydrator->hydrate($method, $parameters, $this);
	}
	
}

For Control, you can use constructor or @inject with help of DecoratorExtension.

Use Case

In template

<a n:href="Product:detail, product => $product->getId()">Product detail</a>

In presenter

class SomePresenter extends Presenter
{

	public function actionDetail(App\Entities\Product $product)
	{
		dump($product); // "App\Entities\Product" object
	}

}
  • v5.1.0 Released version 5.1

    • bump min version to PHP 5.6
    • bump min version to Nette 2.3
    • Contracts introduced

    Full diff: v5.0.0...v5.1.0

  • v2.0.4 Released version 2.0.4

    Bugfixes:

    Full diff: v2.0.3...v2.0.4

  • v2.0.2 Released version 2.0.2

    • min PHP 5.4
    • tests added
    • BC break: extension renamed
bar-chart-fill

Statistics

download-cloud-fill
3004
star-fill
14
bug-fill
0
flashlight-fill
8.4y
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=5.6)
nette/di (~2.3)
Componette Componette felix@nette.org