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;
$thisTarg = $this->getTargType();
$thatTarg = $otherStub->getTargType();
$thisNull = null === $thisTarg;
$thatNull = null === $thatTarg;
if ($thisNull == $thatNull && null === $thatTarg) {
null === $thatTarg
false
if((!$thisNull &&
!$thatNull) &&
($this->getBaseType() !== $otherStub->getTargType() ||
$otherStub->getBaseType() !== $this->getTargType())
){
if ($thisNull && ($thatTarg != $this->getBaseType())) {
if ($thatNull && ($thisTarg != $otherStub->getBaseType())) {
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';