Giter VIP home page Giter VIP logo

cooptilleulsmigrationbundle's People

Contributors

alanpoulain avatar dunglas avatar vincentchalamon avatar

Stargazers

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

Watchers

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

cooptilleulsmigrationbundle's Issues

Transform annotation not found when Proxies class object pass through the TransformerEventListener::getTransformerAnnotation()

Our context:
We have a User that we want to soft delete

// Entity\User.php

/**
 * @ApiResource(...)
 *
 * @ORM\EntityListeners({"AppBundle\EntityListener\UserEntityListener"})
 * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=true)
 * @Transformer("AppBundle\Transformer\UserTransformer")
 */
class User implements UserInterface
{
   //...
}

Issue:
We use the Transformer, however our object does not pass through the delete() of our UserTransformer as it passed through the preRemove() of the UserEntityListener.

After research and testing, it seems that our object is under the class Proxies\__CG __\AppBundle\Entity\User. However, in this case when passing through the getTransformerAnnotation() function of the TransformerEventListener, the @Transformer annotation is not found by reflection. And thus hasTransformer() return false, and in preRemove() the event is not triggered.

Proposed solution:
I solve this issue, but I have to edit your bundle, this way:

// TransformerEventListener.php

private function getTransformerAnnotation($object)
{
    $pattern = 'Proxies\\__CG__\\';
    if (0 === strpos(get_class($object), $pattern)) {
        $notProxiClassName = substr(get_class($object), strlen($pattern));
        $object = new $notProxiClassName;
    }
    return $this->reader->getClassAnnotation(new \ReflectionClass($object), Transformer::class);
}

For you, is it really an issue to fix from your side, or would it be up to me to make sure not to have a class Proxies\__CG__\... ?

Thank you, and do not hesitate to ask for more information

Use autowiring on loaders with parents

It's impossible to use autowiring with parent keyword:

services:
    App\Loader\UserLoader:
        class: App\Loader\UserLoader
        parent: coop_tilleuls_migration.loader.abstract
        autowire: false
        autoconfigure: false
        public: false
        tags:
            - { name: coop_tilleuls_migration.loader, alias: user }

Fix CI

  • Fix CI
  • Update to Symfony 5.1

Supports Symfony 3.3

Supports Symfony 3.3
Remove alias on tag declaration (improvement for autowiring)

Add a Flex recipe

With a default configuration, to prevent having this error during install:

The child node "legacy_connection_name" at path "coop_tilleuls_migration" must be configured.

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.