Giter Site home page Giter Site logo

aop's People

Contributors

dakorpar avatar echo511 avatar enumag avatar fprochazka avatar jost125 avatar mordred avatar mrtnzlml avatar norbe avatar paveljurasek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aop's Issues

Tag release compatible with nette 2.3

Currently, master version is compatible with nette 2.3, but there is not tagged release with nette 2.3 support.

There should be a tag for it, because otherwise installing via composer does not offer stable compatible version.

Parse error - compatibility with nette 2.3

With nette 2.3 AOP ends with parse error at generated cache.

Problem is with that resolving class name of container ends with NULL, so whole cache is surrounded by "namespace Kdyby\Aop_CG\ { }" instead of "namespace Kdyby\Aop_CG\ContainerClassName { }".

Solution is to replace line https://github.com/Kdyby/Aop/blob/master/src/Kdyby/Aop/DI/AopExtension.php#L77 with
$cg = $file->getNamespace('Kdyby\Aop_CG\' . $builder->getClassName());

I have no idea how to prepare patch as there is no 2.3 branch. Do you plann it? Or should I check for existence of method getClassName?

Interface for proxy classes

It would be great if the generated proxy classes implement some interface. Then you will be able to test it as:

$isProxy = $instance instanceof SOME_INTERFACE;

Weawing doesn't support annotated targets with use statements

I want to access the annotation in the aspect when using methodAnnotatedWith with the annotation in a namespace. The adviced method file uses a use statement importing the annotation, but the use statement is not generated in the PHP file when compiling.

use MyAnnotation\DoThings;

...

/**
  * @DoThings
  */
public function method() { ... }

Accessing the annotation on the target results in an exception:

[Semantical Error] The annotation "@DoThings" in method Service::method() was never imported. Did you maybe forget to add a "use" statement for this annotation?

The usecase is to get the information stored in the annotation and process it in the aspect using the AnnotationReader (since Nette annotation doesn't support use statements imports of annotation classes), like this:

$reader->getMethodAnnotation($around->getTargetReflection(), 'MyAnnotation\DoThings');

Or is there a way to get the annotation object defined by the pointcut?

Aspect's config definition doesn't support arguments

If I want to specify arguments of the aspect myself and not by autowiring, the standard way doesn't work:

aspects:
    - MyAspect(@dep)

will throw exception:

The service definition {"value":"Aspect","attributes":["@dep"]} is expected to be an array or Neon entity.

Shouldn't the following condition on line AspectsConfig:62

if (!is_string($def) && (!$def instanceof \stdClass || empty($def->entity))) {

be

if (!is_string($def) && (!$def instanceof \stdClass || empty($def->value))) {

(changing $def->entity to $def->value)?

Release compatible with nette 2.4/ allow symfony/property-access newer versions

I'm trying to install this package but I'm not able to install since all other packages I'm using are up to date while this package requires old/obsolete packages. I can't even use version on master because symphony property accessor:

Installation request for kdyby/aop dev-master -> satisfiable by kdyby/aop[dev-master].
    - Conclusion: remove symfony/property-access v3.2.4
    - Conclusion: don't install symfony/property-access v3.2.4
    - kdyby/aop dev-master requires symfony/property-access ~2.6 -> satisfiable by symfony/property-access[v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v
2.6.9, v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2
.7.9, v2.8.0, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.2, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9].

"Use" statement for annotation is missing in cache file

Im not sure if is this bug or i m just doing things in wrong way.

My problem is this:

	/**
	 * @Aop\Before("methodAnnotatedWith(app\Model\Anotations\Resource)")
	 */
	public function resource(Aop\JoinPoint\BeforeMethod $beforeMethod) {

		$annotations = $this->annotationReader->getMethodAnnotations($beforeMethod->getTargetReflection());
		//Throws Err
		//[Semantical Error] The annotation "@resource" in method presenter::actionDefault() was never imported.
		// Did you maybe forget to add a "use" statement for this annotation?
	}

When i try to get annotation from generated class i get error cause
use namespace\to\Resource statement for annotation is missing in generated presenter

Advice on constructor throws Fatal Error

When you try create advice on constructor, it's thrown Call to a member function createService() on a non-object.

The problem is that the container is injected after creation of proxy class.

Possible selutions are constructor injection or disabling creation advice on constructor (including ns\class->*())

Default arguments

If the target method have default arguments the generated method will throw Notice about undefined offset:

public function link($destination, $args = array())
{
    $__arguments = func_get_args(); $__exception = $__result = NULL;
    $this->__getAdvice(295)->covertParameters($__before = new \Kdyby\Aop\JoinPoint\BeforeMethod($this, __FUNCTION__, $__arguments));
    $__arguments = $__before->getArguments();
    $__result = parent::link($__arguments[0], $__arguments[1]);
    return $__result;
 }

if you call method as $this->link('default'), because func_get_args() returns a copy of the passed arguments only, and does not account for default (non-passed) arguments.

The problem is line:

$__result = parent::link($__arguments[0], $__arguments[1]);

where the $__arguments contains only one element.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.