本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::__construct方法的具体用法?PHP ArrayCollection::__construct怎么用?PHP ArrayCollection::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\ArrayCollection
的用法示例。
在下文中一共展示了ArrayCollection::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Taxonomy constructor.
*
* @param array $elements
* @param MetadataDriver $metadata
*/
public function __construct(array $elements = [], MetadataDriver $metadata = null)
{
parent::__construct($elements);
if ($metadata) {
$this->config = $metadata->getTaxonomyConfig();
}
}
示例2: __construct
public function __construct(array $elements = [])
{
foreach ($elements as $element) {
$this->validate($element);
}
parent::__construct($elements);
}
示例3: __construct
public function __construct(array $array, array $config = NULL)
{
if ($config) {
$this->set('config', new DoctineArrayCollection($config));
}
parent::__construct($array);
}
示例4: __construct
/**
* Constructs a Route object.
*/
public function __construct($path, array $item)
{
$this->path = new PathUtility($path);
// Merge in hook_menu() defaults to normalize things.
$item += ['title callback' => 't', 'title arguments' => [], 'access callback' => 'user_access', 'access arguments' => [], 'page arguments' => [], 'type' => 'MENU_NORMAL_ITEM'];
parent::__construct($item);
}
示例5: __construct
/**
* @param array $elements
* @param null $page
* @param int $rpp
* @param null $total
*/
public function __construct(array $elements = [], $page = null, $rpp = 10, $total = null)
{
$this->page = $page;
$this->rpp = $rpp;
$this->total = $total;
parent::__construct($elements);
}
示例6: __construct
/**
* Constructor
*
* @param array $elements
* @param ArrayCollection $received
* @param Basket $basket
* @param Boolean $flatten
*/
public function __construct(array $elements, ArrayCollection $received, Basket $basket = null, $flatten = self::FLATTEN_NO)
{
parent::__construct($elements);
$this->received = $received;
$this->basket = $basket;
$this->isSingleStory = $flatten !== self::FLATTEN_YES && 1 === count($this) && $this->first()->isStory();
if (self::FLATTEN_NO !== $flatten) {
$to_remove = [];
foreach ($this as $key => $record) {
if ($record->isStory()) {
if (self::FLATTEN_YES === $flatten) {
$to_remove[] = $key;
}
foreach ($record->get_children() as $child) {
$this->set($child->get_serialize_key(), $child);
}
}
}
foreach ($to_remove as $key) {
$this->remove($key);
}
}
$i = 0;
$records = $this->toArray();
array_walk($records, function ($record) use(&$i) {
$record->setNumber($i++);
});
}
示例7: __construct
public function __construct(array $elements = array())
{
parent::__construct();
foreach ($elements as $element) {
$this->add($element);
}
}
示例8: __construct
public function __construct(array $elements = array(), $offset, $limit, $totalCount)
{
$this->offset = (int) $offset;
$this->limit = (int) $limit;
$this->totalCount = (int) $totalCount;
parent::__construct($elements);
}
示例9: __construct
public function __construct(array $days = [])
{
parent::__construct();
foreach ($days as $day) {
$this->addDay($day);
}
}
示例10: __construct
/**
* Initializes a new Result.
*
* @param Query $query
* @param array $elements
* @param integer $recordsCount
*/
public function __construct(Query $query, array $elements = array(), $recordsCount = 0)
{
$this->query = $query;
$this->recordsCount = $recordsCount;
parent::__construct($elements);
$this->count = $this->count();
$this->elements = $elements;
}
示例11: __construct
/**
* Initializes a new ModulesCollection.
*
* @param Module[] $modules
*/
public function __construct(array $modules = array())
{
$constructed = array();
foreach ($modules as $module) {
$constructed[$module->getIdentifier()] = $module;
}
parent::__construct($constructed);
}
示例12: __construct
/**
* Initializes a new ArrayCollection.
*
* @param array $elements
* @param bool $hasBeenRandomized
*/
public function __construct(array $elements = array(), $hasBeenRandomized = false)
{
parent::__construct();
foreach ($elements as $element) {
$this->add($element);
}
$this->hasBeenRandomized = $hasBeenRandomized;
}
示例13: __construct
/**
* {@inheritdoc}
*/
public function __construct(array $elements = [])
{
parent::__construct($elements);
$this->keys = [];
foreach ($elements as $element) {
$this->keys[(string) $element] = true;
}
}
示例14: __construct
public function __construct(array $elements = array())
{
parent::__construct($elements);
$this->add(new EqualsSearchOperator());
$this->add(new LikeSearchOperator());
$this->add(new LikeApproxSearchOperator());
$this->add(new GreaterThanSearchOperator());
$this->add(new LowerThanSearchOperator());
}
示例15: __construct
public function __construct(array $elements)
{
foreach ($elements as $element) {
if (!$element instanceof ClientAccount) {
throw new \InvalidArgumentException('Elements must be instance of ClientAccount.');
}
}
parent::__construct(array_values($elements));
}