2017 © Pedro PelΓ‘ez
 

symfony-bundle aop-feature-bundle

AOP features for Symfony 2

image

sibset/aop-feature-bundle

AOP features for Symfony 2

  • Sunday, October 20, 2013
  • by pavelgopanenko
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AOP Features Bundle

Build Status Scrutinizer Quality Score, (*1)

Π Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ Symfony Framework для аспСктно-ΠΎΡ€ΠΈΠ΅Π½Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½Π½ΠΎΠ³ΠΎ программирования. ДобавляСт Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ ΡƒΠΊΠ°Π·Π²Ρ‹Π²Π°Ρ‚ΡŒ аспСкты для ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ², ΡƒΠΌΠ΅Π½ΡŒΡˆΠ°Ρ количСство сквозного ΠΊΠΎΠ΄Π° Π² ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠΈ., (*2)

АспСкты

Π Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ поставляСт ряд Π³ΠΎΡ‚ΠΎΠ²Ρ‹Ρ… аспСктов., (*3)

Logging

АспСкт для логирования Π²Ρ‹Π·ΠΎΠ²Π° ΠΌΠ΅Ρ‚ΠΎΠ΄Π°., (*4)

<?php

use SibSet\Bundle\AopFeatureBundle\Annotation as Aspect;

/**
 * @Aspect\Logging("log.message.writer.user.create")
 */
public function createUser(User $user)
{
    // ...
}

Π’ Π°Π½Π½ΠΎΡ‚Π°Ρ†ΠΈΠΈ трСбуСтся ΡƒΠΊΠ°Π·Π°Ρ‚ΡŒ ΠΈΠ΄Π΅Π½Ρ‚ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€ сСрвиса Π² ΠΊΠΎΠ½Ρ‚Π΅ΠΉΠ½Π΅Ρ€Π΅ зависмостСй. БСрвис Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±Ρ‹Ρ‚ΡŒ наслСдником класса SibSet\Bundle\AopFeatureBundle\Aspect\Logging\AbstractWriter, (*5)

Transaction

ИпользованиС Ρ‚Ρ€Π°Π½Π·Π°ΠΊΡ†ΠΈΠΈ для ΠΌΠ΅Ρ‚ΠΎΠ΄Π°, (*6)

<?php

use SibSet\Bundle\AopFeatureBundle\Annotation as Aspect;

/**
 * @Aspect\Transactional
 */
public function createUser(User $user)
{
    $this->getManager()->persist($user);
    $this->getManager()->flush($user);
}

Π’Ρ‹Π·ΠΎΠ² ΠΌΠ΅Ρ‚ΠΎΠ΄Π° Π±ΡƒΠ΄Π΅Ρ‚ ΠΎΠ±Π΅Ρ€Π½ΡƒΡ‚ Π² try...catch Π±Π»ΠΎΠΊ с Π²Ρ‹Π·ΠΎΠ²ΠΎΠΌ commit() Π² try ΠΈ rollback() Π² catch, (*7)

SuppressException

ПодавлСниС ΠΈΡΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠΉ Π² ΠΌΠ΅Ρ‚ΠΎΠ΄Π΅, ΠΏΠΎΠ»Π΅Π·Π½ΠΎ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ Π² связкС с Logging, (*8)

<?php

use SibSet\Bundle\AopFeatureBundle\Annotation as Aspect;

/**
 * @Aspect\SuppressException
 */
public function createUser(User $user)
{
    throw new \Exception("All is dust!");
}

Π’ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ ΡƒΠΊΠ°Π·Π°Ρ‚ΡŒ ΠΊΠΎΠ½ΠΊΡ€Π΅Ρ‚Π½Ρ‹ΠΉ Ρ‚ΠΈΠΏ ΠΏΠ΅Ρ€Π΅Ρ…Π²Π°Ρ‚Ρ‹Π²Π°Π΅ΠΌΠΎΠ³ΠΎ ΠΈΡΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΡ, (*9)

/**
 * @Aspect\SuppressException("\RuntimeException")
 */
public function createUser(User $user)

Установка

Composer

Π”ΠΎΠ±Π°Π²Ρ‚Π΅ зависимости Π² ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π½Ρ‹ΠΉ Ρ„Π°ΠΉΠ» composer.json, (*10)

"require": {
    # ..
    "sibset/aop-feature-bundle": ">=1.0.0"
    # ..
}

AppKernel.php

<?php
public function registerBundles()
{
    $bundles = array(
        // ...
        new JMS\AopBundle\JMSAopBundle(),
        new SibSet\Bundle\SibSetAopBundle(),
    );

    // ...

    return $bundles;
}

The Versions

20/10 2013

dev-master

9999999-dev

AOP features for Symfony 2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pavel Gopanenko

annotations aop

07/10 2013

v1.0.0-beta.1

1.0.0.0-beta1

AOP features for Symfony 2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pavel Gopanenko

annotations aop