Code Duplication    Length = 21-21 lines in 5 locations

src/cli/Database/Base/Channel.php 1 location

@@ 565-585 (lines=21) @@
562
     * @see Channel::setDeleted()
563
     * @see Channel::isDeleted()
564
     */
565
    public function delete(ConnectionInterface $con = null)
566
    {
567
        if ($this->isDeleted()) {
568
            throw new PropelException("This object has already been deleted.");
569
        }
570
571
        if ($con === null) {
572
            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
573
        }
574
575
        $con->transaction(function () use ($con) {
576
            $deleteQuery = ChildChannelQuery::create()
577
                ->filterByPrimaryKey($this->getPrimaryKey());
578
            $ret = $this->preDelete($con);
579
            if ($ret) {
580
                $deleteQuery->delete($con);
581
                $this->postDelete($con);
582
                $this->setDeleted(true);
583
            }
584
        });
585
    }
586
587
    /**
588
     * Persists this object to the database.

src/cli/Database/Base/Connection.php 1 location

@@ 693-713 (lines=21) @@
690
     * @see Connection::setDeleted()
691
     * @see Connection::isDeleted()
692
     */
693
    public function delete(ConnectionInterface $con = null)
694
    {
695
        if ($this->isDeleted()) {
696
            throw new PropelException("This object has already been deleted.");
697
        }
698
699
        if ($con === null) {
700
            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
701
        }
702
703
        $con->transaction(function () use ($con) {
704
            $deleteQuery = ChildConnectionQuery::create()
705
                ->filterByPrimaryKey($this->getPrimaryKey());
706
            $ret = $this->preDelete($con);
707
            if ($ret) {
708
                $deleteQuery->delete($con);
709
                $this->postDelete($con);
710
                $this->setDeleted(true);
711
            }
712
        });
713
    }
714
715
    /**
716
     * Persists this object to the database.

src/cli/Database/Base/Instance.php 1 location

@@ 521-541 (lines=21) @@
518
     * @see Instance::setDeleted()
519
     * @see Instance::isDeleted()
520
     */
521
    public function delete(ConnectionInterface $con = null)
522
    {
523
        if ($this->isDeleted()) {
524
            throw new PropelException("This object has already been deleted.");
525
        }
526
527
        if ($con === null) {
528
            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
529
        }
530
531
        $con->transaction(function () use ($con) {
532
            $deleteQuery = ChildInstanceQuery::create()
533
                ->filterByPrimaryKey($this->getPrimaryKey());
534
            $ret = $this->preDelete($con);
535
            if ($ret) {
536
                $deleteQuery->delete($con);
537
                $this->postDelete($con);
538
                $this->setDeleted(true);
539
            }
540
        });
541
    }
542
543
    /**
544
     * Persists this object to the database.

src/cli/Database/Base/Subscription.php 1 location

@@ 838-858 (lines=21) @@
835
     * @see Subscription::setDeleted()
836
     * @see Subscription::isDeleted()
837
     */
838
    public function delete(ConnectionInterface $con = null)
839
    {
840
        if ($this->isDeleted()) {
841
            throw new PropelException("This object has already been deleted.");
842
        }
843
844
        if ($con === null) {
845
            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
846
        }
847
848
        $con->transaction(function () use ($con) {
849
            $deleteQuery = ChildSubscriptionQuery::create()
850
                ->filterByPrimaryKey($this->getPrimaryKey());
851
            $ret = $this->preDelete($con);
852
            if ($ret) {
853
                $deleteQuery->delete($con);
854
                $this->postDelete($con);
855
                $this->setDeleted(true);
856
            }
857
        });
858
    }
859
860
    /**
861
     * Persists this object to the database.

src/cli/Database/Base/User.php 1 location

@@ 582-602 (lines=21) @@
579
     * @see User::setDeleted()
580
     * @see User::isDeleted()
581
     */
582
    public function delete(ConnectionInterface $con = null)
583
    {
584
        if ($this->isDeleted()) {
585
            throw new PropelException("This object has already been deleted.");
586
        }
587
588
        if ($con === null) {
589
            $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
590
        }
591
592
        $con->transaction(function () use ($con) {
593
            $deleteQuery = ChildUserQuery::create()
594
                ->filterByPrimaryKey($this->getPrimaryKey());
595
            $ret = $this->preDelete($con);
596
            if ($ret) {
597
                $deleteQuery->delete($con);
598
                $this->postDelete($con);
599
                $this->setDeleted(true);
600
            }
601
        });
602
    }
603
604
    /**
605
     * Persists this object to the database.