Code Duplication    Length = 21-21 lines in 2 locations

src/eXpansion/Bundle/LocalRecords/Model/Base/Record.php 1 location

@@ 855-875 (lines=21) @@
852
     * @see Record::setDeleted()
853
     * @see Record::isDeleted()
854
     */
855
    public function delete(ConnectionInterface $con = null)
856
    {
857
        if ($this->isDeleted()) {
858
            throw new PropelException("This object has already been deleted.");
859
        }
860
861
        if ($con === null) {
862
            $con = Propel::getServiceContainer()->getWriteConnection(RecordTableMap::DATABASE_NAME);
863
        }
864
865
        $con->transaction(function () use ($con) {
866
            $deleteQuery = ChildRecordQuery::create()
867
                ->filterByPrimaryKey($this->getPrimaryKey());
868
            $ret = $this->preDelete($con);
869
            if ($ret) {
870
                $deleteQuery->delete($con);
871
                $this->postDelete($con);
872
                $this->setDeleted(true);
873
            }
874
        });
875
    }
876
877
    /**
878
     * Persists this object to the database.

src/eXpansion/Framework/PlayersBundle/Model/Base/Player.php 1 location

@@ 766-786 (lines=21) @@
763
     * @see Player::setDeleted()
764
     * @see Player::isDeleted()
765
     */
766
    public function delete(ConnectionInterface $con = null)
767
    {
768
        if ($this->isDeleted()) {
769
            throw new PropelException("This object has already been deleted.");
770
        }
771
772
        if ($con === null) {
773
            $con = Propel::getServiceContainer()->getWriteConnection(PlayerTableMap::DATABASE_NAME);
774
        }
775
776
        $con->transaction(function () use ($con) {
777
            $deleteQuery = ChildPlayerQuery::create()
778
                ->filterByPrimaryKey($this->getPrimaryKey());
779
            $ret = $this->preDelete($con);
780
            if ($ret) {
781
                $deleteQuery->delete($con);
782
                $this->postDelete($con);
783
                $this->setDeleted(true);
784
            }
785
        });
786
    }
787
788
    /**
789
     * Persists this object to the database.