/** * Copy and set the types from the builder being used to initialize the * Property. This method should be called from the constructor of a * concrete implementation. * @param \EVought\vCardTools\TypedPropertyBuilder $builder The builder * being used to initialize this Property. */ protected function setTypesFromBuilder(TypedPropertyBuilder $builder) { $this->types = $builder->getTypes(); if (!empty($this->types)) { $this->hasParameters = true; \sort($this->types); // Make comparisons stable } }
/** * Retrieve all types associated with a given property/id in the db. * @param TypedPropertyBuilder $property The builder to add types to. * @param type $propertyID The ID of the property to fetch types for within * the property-specific sub-table. * @param string $queryName If provided, is the name of the pre-configured * SQL query to use to fetch types for this property, otherwise the * property name from the builder will be used. * @return bool true if-and-only-if types were fetched. */ private function fetchTypesForPropertyID(TypedPropertyBuilder $builder, $propertyID, $queryName = null) { assert(null !== $propertyID); assert(is_numeric($propertyID)); if (null === $queryName) { $queryName = $builder->getName(); } $stmt = $this->prepareCannedQuery('fetchTypes', $queryName); $stmt->bindValue(":id", $propertyID); $stmt->execute(); $results = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0); $stmt->closeCursor(); $builder->setTypes($results); return empty($results); }