Code Duplication    Length = 32-34 lines in 2 locations

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

@@ 538-571 (lines=34) @@
535
     * @return void
536
     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
537
     */
538
    public function reload($deep = false, ConnectionInterface $con = null)
539
    {
540
        if ($this->isDeleted()) {
541
            throw new PropelException("Cannot reload a deleted object.");
542
        }
543
544
        if ($this->isNew()) {
545
            throw new PropelException("Cannot reload an unsaved object.");
546
        }
547
548
        if ($con === null) {
549
            $con = Propel::getServiceContainer()->getReadConnection(UserTableMap::DATABASE_NAME);
550
        }
551
552
        // We don't need to alter the object instance pool; we're just modifying this instance
553
        // already in the pool.
554
555
        $dataFetcher = ChildUserQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
556
        $row = $dataFetcher->fetch();
557
        $dataFetcher->close();
558
        if (!$row) {
559
            throw new PropelException('Cannot find matching row in the database to reload object values.');
560
        }
561
        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
562
563
        if ($deep) {  // also de-associate any related objects?
564
565
            $this->aInstance = null;
566
            $this->collConnections = null;
567
568
            $this->collSubscriptions = null;
569
570
        } // if (deep)
571
    }
572
573
    /**
574
     * Removes this object from datastore and sets delete attribute.

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

@@ 695-726 (lines=32) @@
692
     * @return void
693
     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
694
     */
695
    public function reload($deep = false, ConnectionInterface $con = null)
696
    {
697
        if ($this->isDeleted()) {
698
            throw new PropelException("Cannot reload a deleted object.");
699
        }
700
701
        if ($this->isNew()) {
702
            throw new PropelException("Cannot reload an unsaved object.");
703
        }
704
705
        if ($con === null) {
706
            $con = Propel::getServiceContainer()->getReadConnection(InputTableMap::DATABASE_NAME);
707
        }
708
709
        // We don't need to alter the object instance pool; we're just modifying this instance
710
        // already in the pool.
711
712
        $dataFetcher = ChildInputQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
713
        $row = $dataFetcher->fetch();
714
        $dataFetcher->close();
715
        if (!$row) {
716
            throw new PropelException('Cannot find matching row in the database to reload object values.');
717
        }
718
        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
719
720
        if ($deep) {  // also de-associate any related objects?
721
722
            $this->aInstance = null;
723
            $this->collSubscriptions = null;
724
725
        } // if (deep)
726
    }
727
728
    /**
729
     * Removes this object from datastore and sets delete attribute.