Coder Social home page Coder Social logo

Comments (4)

rubenvanassche avatar rubenvanassche commented on August 29, 2024 1

Yeah it is a circular loop, something validation rules generation doesn't like 😄

from laravel-data.

jhorie avatar jhorie commented on August 29, 2024
class Item extends Data {
  public function __construct(
    public int $item_id,
    public int $quantity,
    public ?Item $subItem) {}
}

This is also giving the same timeout. Looks like nesting same class gives you a timeout.

This timeout is only happening when using Item data class injection in a method of a controller. So like this:

class AppController extends Controller {
  public function sendOrder(Item $item) {

  }
}

When using the following, it works great:

class AppController extends Controller {
  public function sendOrder() {
    $item = Item::from(request()->all());
  }
}

This is also true for Azeirah, she is my collegue.

from laravel-data.

rubenvanassche avatar rubenvanassche commented on August 29, 2024

This is impossible because we cannot know how deep we should generate validation rules, I've added a section in the docs describing it:

## Validation and nesting or collecting the same class

from laravel-data.

DiederikvandenB avatar DiederikvandenB commented on August 29, 2024

@rubenvanassche is this also impossible for a many to many relationship? I have an InvoiceData class which has a DataCollectionOf(TransactionData::class), and the TransactionData class also has a DataCollectionOf(InvoiceData::class). Currently, I get a timeout/memory leak when I run InvoiceData::getValidationRules();

from laravel-data.

Related Issues (20)

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.