for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace AlgoWeb\PODataLaravel\Models\ObjectMap\Entities\Associations;
use POData\Common\InvalidOperationException;
class AssociationStubPolymorphic extends AssociationStubBase
{
/**
* @var string
*/
private $morphType;
* @return string
public function getMorphType()
return $this->morphType;
}
* @param string $morphType
public function setMorphType($morphType)
$this->morphType = $morphType;
* @param \AlgoWeb\PODataLaravel\Models\ObjectMap\Entities\Associations\AssociationStubBase $otherStub
*
* @return bool
public function isCompatible(AssociationStubBase $otherStub)
if (!parent::isCompatible($otherStub)) {
return false;
if (null === $this->getTargType() && null === $otherStub->getTargType()) {
null === $this->getTargType()
false
$thisBase = $this->getBaseType();
$thatBase = $otherStub->getBaseType();
$thatTarg = $otherStub->getTargType() ?? $thisBase;
$thisTarg = $this->getTargType() ?? $thatBase;
if ($thatTarg != $thisBase) {
if ($thisTarg != $thatBase) {
return true;
* @throws InvalidOperationException
public function isKnownSide()
if (!($this->isOk())) {
throw new InvalidOperationException('Polymorphic stub not OK so known-side determination is meaningless');
return null === $this->targType;
* {@inheritdoc}
public function morphicType()
return 'polymorphic';