propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 399 forks source link

Remove deprecated #1892

Closed mringler closed 2 years ago

mringler commented 2 years ago

I'm getting warnings because declarations of setPrimaryKey() do not match between extending classes:

PHP Warning: Declaration of Nivm\Model\Person\Base\Person::setPrimaryKey(?int $key = NULL): void should be compatible with Nivm\Model\Util\Base\ChangedBy::setPrimaryKey($pk): void in /srv/www/html/nivm/src/Nivm/Model/Person/Base/Person.php on line 2700

setPrimaryKey(?int $key = NULL): void vs setPrimaryKey($pk): void

I am extending tables via concrete_inheritance behavior, and the parent table does not have a primary key. Apparently this leads to the parent class having a stub for setPrimaryKey(), which is defined differently than the function on the child class. Since the parent class has not PK declaration itself, and can be parent to tables with different PK types, it is not possible to insert a type hint there.

Fortunately, adding setPrimaryKey() to tables without PK has been marked as deprecated since 2011, so I think the problem can be easily solved by just removing that function.

mringler commented 2 years ago

Uff, test fail because of problem with test setup:

Error: dealerdirect/phpcodesniffer-composer-installer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. You can run "composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)

Not sure where this comes from or how to handle it

dereuromark commented 2 years ago

This is now solved, you can probably rebase

mringler commented 2 years ago

Oh, completely forgot about this. Merged in master, now tests run through