Skip to content

Build model relation methods without ConnectionInterface param#119

Draft
mringler wants to merge 1 commit intoperplorm:mainfrom
mringler:con_on_relations
Draft

Build model relation methods without ConnectionInterface param#119
mringler wants to merge 1 commit intoperplorm:mainfrom
mringler:con_on_relations

Conversation

@mringler
Copy link
Copy Markdown
Collaborator

@mringler mringler commented Mar 11, 2026

First draft for removing the ConnectionInterface parameter from relation methods by setting configuration parameter generator.omitConnectionInterfaceParameterOnRelationMethods to true.

Example:

    /**
     * @param \Propel\Runtime\ActiveQuery\Criteria|null $criteria
     * @param \Propel\Runtime\Connection\ConnectionInterface|null $con
     *
     * @return \Propel\Tests\Bookstore\Base\Collection\BookCollection
     */
    public function getBooks(?Criteria $criteria = null, ?ConnectionInterface $con = null): BookCollection
    {

becomes

    /**
     * @param \Propel\Runtime\ActiveQuery\Criteria|null $criteria
     *
     * @return \Propel\Tests\Bookstore\Base\Collection\BookCollection
     */
    public function getBooks(?Criteria $criteria = null): BookCollection
    {

Not sure if this matches #41 as there is still the ?Criteria $criteria = null param.

Manual setup passes sniffer and linter, but no tests yet.

@oojacoboo
Copy link
Copy Markdown

@mringler nice! And yea, until the getter is clean, the model is still polluted with Propel specific implementation details. Meaning, the Criteria needs to go as well, or at least be a setting to be optionally removed. If someone wants to further filter a relation, they could define the method in their child class and add their filter logic. Forcing that thing down on a child class means it's impossible to have pure/clean domain models.

@mringler mringler changed the base branch from develop to main March 17, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants