Set the ancestors of the specified page or taxonomy

@param int $object_id Post ID or Term ID
@param string $object_type
432027
protected function set_ancestors( $object_id, $object_type ) {
		$ancestors = get_ancestors( $object_id, $object_type );
		krsort( $ancestors );
		if ( 'page' === $object_type ) {
			foreach ( $ancestors as $ancestor_id ) {
				$this->set( get_the_title( $ancestor_id ), get_permalink( $ancestor_id ) );
			}
		} else {
			foreach ( $ancestors as $ancestor_id ) {
				$ancestor = get_term( $ancestor_id, $object_type );
				$this->set( $ancestor->name, get_term_link( $ancestor ) );
			}
		}
	}
139658
protected function respondRelatedAddresses($addressableId, $objectType)
    {
        $addresses = Address::where('addressable_id', $addressableId)
            ->orderBy('created_at', 'desc')
            ->get();
        return fractal($addresses, new AddressTransformer())
            ->withResourceName("{$objectType}Address")
            ->respond();
    }
334847
public function loadObjectSettingsDefaults($object_id)
    {
        $em = $this->getEntityManager();

        $object = $em->getRepository('ACSACSPanelBundle:Service')->find($object_id);
        $object_fields = $object->getType()->getFieldTypes();

        return $object_fields;
    }
1200589
def get_ancestor_object_by_type(self, obj_type):
        

        if self.type.lower() == obj_type.lower():
            return self
        else:
            if not self.parent:
                return None
            return self.parent.get_ancestor_object_by_type(obj_type)
994733
public function get_value( $object_id, $request ) {
		$fields   = $this->get_registered_fields();
		$response = array();

		foreach ( $fields as $name => $args ) {
			$all_values = get_metadata( $this->get_meta_type(), $object_id, $name, false );
			if ( $args['single'] ) {
				if ( empty( $all_values ) ) {
					$value = $args['schema']['default'];
				} else {
					$value = $all_values[0];
				}
				$value = $this->prepare_value_for_response( $value, $request, $args );
			} else {
				$value = array();
				foreach ( $all_values as $row ) {
					$value[] = $this->prepare_value_for_response( $row, $request, $args );
				}
			}

			$response[ $name ] = $value;
		}

		return (object) $response;
	}
1121680
protected function check_object_id( $object_id ) {
		$fetcher = new CommentFetcher();
		$comment = $fetcher->get_check( $object_id );
		return $comment->comment_ID;
	}
83765
public static function updateNote(
        int $object_id, int $note_id, string $title = null, string $note = null)
    {

        $note_record = Note::where('object_type', __CLASS__)
            ->where('object_id', $object_id)
            ->where('id', $note_id)
            ->first();

        if (! is_null($title))
            $note_record->title = $title;

        if (! is_null($note))
            $note_record->note = $note;

        $note_record->save();

    }
715436
@Override
  public final boolean setRoutingObjectID(DBID objectID) {
    if(objectID == routingObjectID || DBIDUtil.equal(objectID, routingObjectID)) {
      return false;
    }
    this.routingObjectID = objectID;
    return true;
  }
1233078
public function setObjectPrototype($objectPrototype)
    {
        if (!is_object($objectPrototype)
            || (!$objectPrototype instanceof ArrayObject && !method_exists($objectPrototype, 'exchangeArray'))

        ) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Object must be of type %s, or at least implement %s',
                'ArrayObject',
                'exchangeArray'
            ));
        }
        $this->arrayObjectPrototype = $objectPrototype;
        return $this;
    }
1210091
public function setType($parameterIndex, ObjectTypeInterface $type)
    {
        $this->setParameter($parameterIndex, $this->escape($type->getQueryName()));
    }
459863
public function register_taxonomy_rules( $taxonomy, $object_type, $args ) {
		global $wp_rewrite;

		/* for 4.7 */
		$args = (array) $args;

		if ( CPTP_Util::get_no_taxonomy_structure() ) {
			return;
		}

		if ( ! empty( $args['_builtin'] ) ) {
			return;
		}

		if ( false === $args['rewrite'] ) {
			return;
		}

		$post_types = $args['object_type'];
		foreach ( $post_types as $post_type ) :
			$post_type_obj = get_post_type_object( $post_type );
			if ( ! empty( $post_type_obj->rewrite['slug'] ) ) {
				$slug = $post_type_obj->rewrite['slug'];
			} else {
				$slug = $post_type;
			}

			if ( ! empty( $post_type_obj->has_archive ) && is_string( $post_type_obj->has_archive ) ) {
				$slug = $post_type_obj->has_archive;
			};

			if ( ! empty( $post_type_obj->rewrite['with_front'] ) ) {
				$slug = substr( $wp_rewrite->front, 1 ) . $slug;
			}

			if ( 'category' === $taxonomy ) {
				$cb            = get_option( 'category_base' );
				$taxonomy_slug = ( $cb ) ? $cb : $taxonomy;
				$taxonomy_key  = 'category_name';
			} else {
				// Edit by [Xiphe].
				if ( isset( $args['rewrite']['slug'] ) ) {
					$taxonomy_slug = $args['rewrite']['slug'];
				} else {
					$taxonomy_slug = $taxonomy;
				}
				// [Xiphe] stop
				$taxonomy_key = $taxonomy;
			}

			$rules = array(
				// feed.
				array(
					'regex'    => '%s/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&feed=\$matches[2]",
				),
				array(
					'regex'    => '%s/(.+?)/(feed|rdf|rss|rss2|atom)/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&feed=\$matches[2]",
				),
				// year.
				array(
					'regex'    => '%s/(.+?)/date/([0-9]{4})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&year=\$matches[2]",
				),
				array(
					'regex'    => '%s/(.+?)/date/([0-9]{4})/page/?([0-9]{1,})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&year=\$matches[2]&paged=\$matches[3]",
				),
				// monthnum.
				array(
					'regex'    => '%s/(.+?)/date/([0-9]{4})/([0-9]{1,2})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&year=\$matches[2]&monthnum=\$matches[3]",
				),
				array(
					'regex'    => '%s/(.+?)/date/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&year=\$matches[2]&monthnum=\$matches[3]&paged=\$matches[4]",
				),
				// day.
				array(
					'regex'    => '%s/(.+?)/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&year=\$matches[2]&monthnum=\$matches[3]&day=\$matches[4]",
				),
				array(
					'regex'    => '%s/(.+?)/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&year=\$matches[2]&monthnum=\$matches[3]&day=\$matches[4]&paged=\$matches[5]",
				),
				// paging.
				array(
					'regex'    => '%s/(.+?)/page/?([0-9]{1,})/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]&paged=\$matches[2]",
				),
				// tax archive.
				array(
					'regex'    => '%s/(.+?)/?$',
					'redirect' => "index.php?{$taxonomy_key}=\$matches[1]",
				),
			);

			// no post_type slug.
			foreach ( $rules as $rule ) {
				$regex    = sprintf( $rule['regex'], "{$taxonomy_slug}" );
				$redirect = $rule['redirect'];
				add_rewrite_rule( $regex, $redirect, 'top' );
			}

			if ( get_option( 'add_post_type_for_tax' ) ) {
				foreach ( $rules as $rule ) {
					$regex    = sprintf( $rule['regex'], "{$slug}/{$taxonomy_slug}" );
					$redirect = $rule['redirect'] . "&post_type={$post_type}";
					add_rewrite_rule( $regex, $redirect, 'top' );
				}
			} else {
				foreach ( $rules as $rule ) {
					$regex    = sprintf( $rule['regex'], "{$slug}/{$taxonomy_slug}" );
					$redirect = $rule['redirect'];
					add_rewrite_rule( $regex, $redirect, 'top' );
				}
			}

			do_action( 'CPTP_registered_' . $taxonomy . '_rules', $object_type, $args, $taxonomy_slug );

		endforeach;
	}
1347303
protected function copyNode(ObjectId $oid) {
    $logger = $this->getLogger();
    if ($logger->isDebugEnabled()) {
      $logger->debug("Copying node ".$oid);
    }
    $persistenceFacade = $this->getPersistenceFacade();

    // load the original node
    $node = $persistenceFacade->load($oid);
    if ($node == null) {
      throw new PersistenceException("Can't load node '".$oid."'");
    }

    // check if we already have a copy of the node
    $nodeCopy = $this->getCopy($node->getOID());
    if ($nodeCopy == null) {
      // if not, create it
      $nodeCopy = $persistenceFacade->create($node->getType());
      $node->copyValues($nodeCopy, false);
    }

    // save copy
    $this->registerCopy($node, $nodeCopy);

    if ($logger->isInfoEnabled()) {
      $logger->info("Copied: ".$node->getOID()." to ".$nodeCopy->getOID());
    }
    if ($logger->isDebugEnabled()) {
      $logger->debug($nodeCopy->__toString());
    }

    // create the connections to already copied relatives
    // this must be done after saving the node in order to have a correct oid
    $mapper = $node->getMapper();
    $relations = $mapper->getRelations();
    foreach ($relations as $relation) {
      if ($relation->getOtherNavigability()) {
        $otherRole = $relation->getOtherRole();
        $relativeValue = $node->getValue($otherRole);
        $relatives = $relation->isMultiValued() ? $relativeValue :
                ($relativeValue != null ? [$relativeValue] : []);
        foreach ($relatives as $relative) {
          $copiedRelative = $this->getCopy($relative->getOID());
          if ($copiedRelative != null) {
            $nodeCopy->addNode($copiedRelative, $otherRole);
            if ($logger->isDebugEnabled()) {
              $logger->debug("Added ".$copiedRelative->getOID()." to ".$nodeCopy->getOID());
              $logger->debug($copiedRelative->__toString());
            }
          }
        }
      }
    }
    return $nodeCopy;
  }
1027097
def index(parent_tree)
      parent_tree = make_object_id(parent_tree)
      if not subtree_of?(parent_tree)
        raise ArgumentError, "#{self.to_s} not a subtree of #{parent_tree.to_s}"
      elsif self.length == parent_tree.length
        raise ArgumentError, "OIDs are the same"
      else
        ObjectId.new(self[parent_tree.length..-1])
      end
    end
903167
public void maybeSetLegacyObjectMapOrRecordType() {
    if (type == Type.UNKNOWN) {
      type = Type.LEGACY_OBJECT_MAP_OR_RECORD;
    } else if (type == Type.MAP) {
      throw new IllegalStateException(
          "Expected a value of type `legacy_object_map`, got `map`. "
              + "These two map types are not interoperable. "
              + "Use `mapToLegacyObjectMap()` to convert this object to a legacy_object_map.");
    }
  }
192394
public function setParent($parent_id = null): self
    {
        $parent_id = ((int) $parent_id > 0) ? (int) $parent_id : null;

        $this->setAttribute('parent_id', $parent_id);

        return $this;
    }
1005306
public function DeleteCache($objectclass,$id)
	{
		$this->_level1Cache->Delete($objectclass . "_" . $id);
		$this->_level2Cache->Delete($objectclass . "_" . $id);
		$this->Observe("Deleted TYPE='$objectclass' ID='$id' from Cache",OBSERVE_DEBUG);
	}
127561
protected function createRequestObject($objectType)
    {
        $repository = $this->getRepository();

        switch ($objectType) {
            case 'SessionInput':
                $this->requestObject = new SessionInput();
                break;
            case 'ContentTypeGroupCreateStruct':
                $this->requestObject = $repository
                    ->getContentTypeService()
                    ->newContentTypeGroupCreateStruct('identifier');
                break;

            case 'ContentTypeGroupUpdateStruct':
                $this->requestObject = $repository
                    ->getContentTypeService()
                    ->newContentTypeGroupUpdateStruct();
                break;

            case 'ViewInput':
                $this->requestObject = new ViewInput();
                break;

            default:
                throw new InvalidArgumentException($objectType, 'type is not defined yet');
        }
    }