for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* components
*
* @author Wolfy-J
*/
namespace Spiral\ORM;
use Spiral\Models\ActiveEntityInterface;
use Spiral\ORM\Commands\InsertCommand;
use Spiral\ORM\Commands\UpdateCommand;
* Adds ActiveRecord abilities to RecordEntity.
abstract class Record extends RecordEntity implements ActiveEntityInterface
{
public function save(TransactionInterface $transaction = null, bool $queueRelations = true): int
//saturate transaction
$transaction->addCommand($command = $this->queueSave($queueRelations));
$transaction
null
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:
function someFunction(A $objectMaybe = null) { if ($objectMaybe instanceof A) { $objectMaybe->doSomething(); } }
if ($command instanceof InsertCommand) {
return self::CREATED;
} elseif ($command instanceof UpdateCommand) {
return self::UPDATED;
}
return self::UNCHANGED;
public function delete(TransactionInterface $transaction = null)
$transaction->addCommand($this->queueDelete());
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: