Code Duplication    Length = 21-21 lines in 3 locations

packages/core/src/Models/Task/Base/Task.php 1 location

@@ 548-568 (lines=21) @@
545
     * @see Task::setDeleted()
546
     * @see Task::isDeleted()
547
     */
548
    public function delete(ConnectionInterface $con = null)
549
    {
550
        if ($this->isDeleted()) {
551
            throw new PropelException("This object has already been deleted.");
552
        }
553
554
        if ($con === null) {
555
            $con = Propel::getServiceContainer()->getWriteConnection(TaskTableMap::DATABASE_NAME);
556
        }
557
558
        $con->transaction(function () use ($con) {
559
            $deleteQuery = ChildTaskQuery::create()
560
                ->filterByPrimaryKey($this->getPrimaryKey());
561
            $ret = $this->preDelete($con);
562
            if ($ret) {
563
                $deleteQuery->delete($con);
564
                $this->postDelete($con);
565
                $this->setDeleted(true);
566
            }
567
        });
568
    }
569
570
    /**
571
     * Persists this object to the database.

packages/selfprice/src/Models/Selfprice/Base/Selfprice.php 1 location

@@ 574-594 (lines=21) @@
571
     * @see Selfprice::setDeleted()
572
     * @see Selfprice::isDeleted()
573
     */
574
    public function delete(ConnectionInterface $con = null)
575
    {
576
        if ($this->isDeleted()) {
577
            throw new PropelException("This object has already been deleted.");
578
        }
579
580
        if ($con === null) {
581
            $con = Propel::getServiceContainer()->getWriteConnection(SelfpriceTableMap::DATABASE_NAME);
582
        }
583
584
        $con->transaction(function () use ($con) {
585
            $deleteQuery = ChildSelfpriceQuery::create()
586
                ->filterByPrimaryKey($this->getPrimaryKey());
587
            $ret = $this->preDelete($con);
588
            if ($ret) {
589
                $deleteQuery->delete($con);
590
                $this->postDelete($con);
591
                $this->setDeleted(true);
592
            }
593
        });
594
    }
595
596
    /**
597
     * Persists this object to the database.

packages/core/src/Models/User/Base/User.php 1 location

@@ 732-752 (lines=21) @@
729
     * @see User::setDeleted()
730
     * @see User::isDeleted()
731
     */
732
    public function delete(ConnectionInterface $con = null)
733
    {
734
        if ($this->isDeleted()) {
735
            throw new PropelException("This object has already been deleted.");
736
        }
737
738
        if ($con === null) {
739
            $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
740
        }
741
742
        $con->transaction(function () use ($con) {
743
            $deleteQuery = ChildUserQuery::create()
744
                ->filterByPrimaryKey($this->getPrimaryKey());
745
            $ret = $this->preDelete($con);
746
            if ($ret) {
747
                $deleteQuery->delete($con);
748
                $this->postDelete($con);
749
                $this->setDeleted(true);
750
            }
751
        });
752
    }
753
754
    /**
755
     * Persists this object to the database.