Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor getReference adding $class parameter #310

Open
aniltonjunior opened this issue Apr 23, 2024 · 0 comments
Open

Refactor getReference adding $class parameter #310

aniltonjunior opened this issue Apr 23, 2024 · 0 comments

Comments

@aniltonjunior
Copy link

Hello, I'm trying to learn how to create my own Rules to address some changes in my project. However, I'm struggling to find material on how to access previous Nodes and obtain the type of an argument. For example, I would like to resolve deprecation warnings resulting from the use of getReference without the argument $class. In my case, I'm having difficulty obtaining the type of the parameter of the setter that expects the result of the getReference method.
I'm trying to achive a result like this:

         $causaPrescritiva = new CausaPrescritivaCredito();
-        $causaPrescritiva->setCredito($this->getReference('Credito-016'));
-        $causaPrescritiva->setTipoCausaPrescritiva($this->getReference('TipoCausaPrescritiva-SUSPENSÃO DA PRESCRIÇÃO POR DEFERIMENTO DE PARCELAMENTO'));
+        $causaPrescritiva->setCredito($this->getReference('Credito-016', Credito::class));
+        $causaPrescritiva->setTipoCausaPrescritiva($this->getReference('TipoCausaPrescritiva-SUSPENSÃO DA PRESCRIÇÃO POR DEFERIMENTO DE PARCELAMENTO', TipoCausaPrescritiva::class));
         $causaPrescritiva->setDataInicio(DateTime::createFromFormat('d/m/y H:i:s', '01/01/02 00:00:00'));
         $causaPrescritiva->setDataFim(DateTime::createFromFormat('d/m/y H:i:s', '01/01/05 00:00:00'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant