Code Duplication    Length = 30-31 lines in 2 locations

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

@@ 815-844 (lines=30) @@
812
     * @return void
813
     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
814
     */
815
    public function reload($deep = false, ConnectionInterface $con = null)
816
    {
817
        if ($this->isDeleted()) {
818
            throw new PropelException("Cannot reload a deleted object.");
819
        }
820
821
        if ($this->isNew()) {
822
            throw new PropelException("Cannot reload an unsaved object.");
823
        }
824
825
        if ($con === null) {
826
            $con = Propel::getServiceContainer()->getReadConnection(RecordTableMap::DATABASE_NAME);
827
        }
828
829
        // We don't need to alter the object instance pool; we're just modifying this instance
830
        // already in the pool.
831
832
        $dataFetcher = ChildRecordQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
833
        $row = $dataFetcher->fetch();
834
        $dataFetcher->close();
835
        if (!$row) {
836
            throw new PropelException('Cannot find matching row in the database to reload object values.');
837
        }
838
        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
839
840
        if ($deep) {  // also de-associate any related objects?
841
842
            $this->aPlayer = null;
843
        } // if (deep)
844
    }
845
846
    /**
847
     * Removes this object from datastore and sets delete attribute.

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

@@ 725-755 (lines=31) @@
722
     * @return void
723
     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
724
     */
725
    public function reload($deep = false, ConnectionInterface $con = null)
726
    {
727
        if ($this->isDeleted()) {
728
            throw new PropelException("Cannot reload a deleted object.");
729
        }
730
731
        if ($this->isNew()) {
732
            throw new PropelException("Cannot reload an unsaved object.");
733
        }
734
735
        if ($con === null) {
736
            $con = Propel::getServiceContainer()->getReadConnection(PlayerTableMap::DATABASE_NAME);
737
        }
738
739
        // We don't need to alter the object instance pool; we're just modifying this instance
740
        // already in the pool.
741
742
        $dataFetcher = ChildPlayerQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
743
        $row = $dataFetcher->fetch();
744
        $dataFetcher->close();
745
        if (!$row) {
746
            throw new PropelException('Cannot find matching row in the database to reload object values.');
747
        }
748
        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
749
750
        if ($deep) {  // also de-associate any related objects?
751
752
            $this->collRecords = null;
753
754
        } // if (deep)
755
    }
756
757
    /**
758
     * Removes this object from datastore and sets delete attribute.