本文整理汇总了PHP中Doctrine_Collection::fromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Collection::fromArray方法的具体用法?PHP Doctrine_Collection::fromArray怎么用?PHP Doctrine_Collection::fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Collection
的用法示例。
在下文中一共展示了Doctrine_Collection::fromArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createCollection
/**
*
* @param string $model_name
* @param array $data
* @return Doctrine_Collection
*/
public static function createCollection($model_name, $data)
{
$collection = new Doctrine_Collection($model_name);
if (!$collection instanceof Doctrine_Collection) {
throw new sfException('Trying to hydrate a non-Doctrine_collection object!');
}
$collection->fromArray($data);
return $collection;
}
示例2: getResults
public function getResults()
{
if (is_null($this->results)) {
$this->getQuery()->orderBy($this->sqlOrderColumn . ' ' . $this->sqlOrder);
$this->results = parent::getResults();
if ($this->sqlOrder !== $this->listOrder) {
$obj = new Doctrine_Collection($this->results->getTable(), $this->results->getKeyColumn());
$obj->fromArray(array_reverse($this->results->toArray(true)));
$this->results = $obj;
}
}
return $this->results;
}
示例3: findMissingElementsInDataSet
/**
* @param $dataSetId
* @param $scenarioId
* @return Doctrine_Collection
*/
public function findMissingElementsInDataSet($dataSetId, $scenarioId)
{
// Préparation de la requête SQL permettant de récupérer les éléments manquants dans le jeu de données.
$querySql = '
SELECT *
FROM ei_data_set_structure ds
WHERE ds.ei_scenario_id = ' . $scenarioId . '
AND id NOT IN (SELECT ei_data_set_structure_id FROM ei_data_line WHERE ei_data_set_id = ' . $dataSetId . ')
ORDER BY lft;
';
// Récupération de tous les éléments.
$resultats = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAll($querySql);
// Importation.
$collection = new Doctrine_Collection("EiDataSetStructure");
$collection->fromArray($resultats);
return $collection;
}
示例4: _loadFromCache
/**
* Load the data from cache
*
* @return void
*/
private function _loadFromCache(Zend_Cache_Core $cache)
{
$cacheData = $cache->load($this->_cacheKey);
$dbData = new Doctrine_Collection($cacheData['tableName']);
$dbData->fromArray($cacheData['dataArray'], self::SERIALIZATION_DEEP);
$this->_dbData = $dbData;
}