本文整理汇总了PHP中Base::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::toArray方法的具体用法?PHP Base::toArray怎么用?PHP Base::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::toArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toArray
/**
* Returns the item values as associative list.
*
* @return array Associative list of item properties and their values
*/
public function toArray()
{
$list = parent::toArray();
$list['order.base.product.baseid'] = $this->getBaseId();
$list['order.base.product.ordprodid'] = $this->getOrderProductId();
$list['order.base.product.type'] = $this->getType();
$list['order.base.product.suppliercode'] = $this->getSupplierCode();
$list['order.base.product.productid'] = $this->getProductId();
$list['order.base.product.prodcode'] = $this->getProductCode();
$list['order.base.product.name'] = $this->getName();
$list['order.base.product.mediaurl'] = $this->getMediaUrl();
$list['order.base.product.position'] = $this->getPosition();
$list['order.base.product.price'] = $this->price->getValue();
$list['order.base.product.costs'] = $this->price->getCosts();
$list['order.base.product.rebate'] = $this->price->getRebate();
$list['order.base.product.taxrate'] = $this->price->getTaxRate();
$list['order.base.product.quantity'] = $this->getQuantity();
$list['order.base.product.status'] = $this->getStatus();
$list['order.base.product.flags'] = $this->getFlags();
return $list;
}
示例2: toArray
public function toArray($columns = NULL)
{
//Include basic category data (id, created_at, updated_at)
$output = parent::toArray();
//Include category translations
$output['category_translations'] = $this->getTranslations()->toArray();
return $output;
}
示例3: toArray
/**
* Returns the array representation of this class
*
* @param string $name
* @return array
*/
public function toArray($name = 'id')
{
return parent::toArray($name);
}
示例4: toArray
/**
* Returns the item values as array.
*
* @return array Associative list of item properties and their values
*/
public function toArray()
{
$list = parent::toArray();
$list['price.typeid'] = $this->getTypeId();
$list['price.type'] = $this->getType();
$list['price.typename'] = $this->getTypeName();
$list['price.currencyid'] = $this->getCurrencyId();
$list['price.domain'] = $this->getDomain();
$list['price.quantity'] = $this->getQuantity();
$list['price.value'] = $this->getValue();
$list['price.costs'] = $this->getCosts();
$list['price.rebate'] = $this->getRebate();
$list['price.taxvalue'] = $this->getTaxValue();
$list['price.taxrate'] = $this->getTaxRate();
$list['price.taxflag'] = $this->getTaxFlag();
$list['price.status'] = $this->getStatus();
$list['price.label'] = $this->getLabel();
return $list;
}
示例5: toArray
/**
* Returns the item values as array.
*
* @return array Associative list of item properties and their values
*/
public function toArray()
{
$list = parent::toArray();
$list['customer.label'] = $this->getLabel();
$list['customer.code'] = $this->getCode();
$list['customer.birthday'] = $this->getBirthday();
$list['customer.status'] = $this->getStatus();
$list['customer.password'] = $this->getPassword();
$list['customer.dateverified'] = $this->getDateVerified();
return $list;
}
示例6: toArray
public function toArray($columns = null)
{
$output = parent::toArray($columns);
//Add the columns from 'article' table to the output
$output['article_translations'] = $this->getTranslations()->toArray();
//We can pass ['columns'=>[...]] to specify which columns to include
$output['article_categories'] = $this->getCategories()->filter(function ($category) {
//Pass each category through a filter and call it's toArray() function
return $category->toArray();
});
$output['article_author'] = $this->getUser(array('columns' => array('user_first_name', 'user_last_name', 'user_email')))->toArray();
$output['article_hashtags'] = $this->getHashtags()->filter(function ($hashtag) {
return $hashtag->toArray();
});
return $output;
}
示例7: compare
public function compare($one, $two)
{
if( !($one instanceof Item) )
{
if( is_integer($one) )
{
$one = Item::getByID($one);
}
else
{
return false;
}
}
if( !($two instanceof Item) )
{
if( is_integer($two) )
{
$two = Item::getByID($two);
}
else
{
return false;
}
}
$ratings[0] = Rating::getByUserForItem($this->user->userid, $one->itemid);
$ratings[1] = Rating::getByUserForItem($this->user->userid, $two->itemid);
$views[0] = View::getByUserForItem($this->user->userid, $one->itemid);
$views[1] = View::getByUserForItem($this->user->userid, $two->itemid);
$willTheyLikeTwoComparedToOne = 0;
//first, try to compare ratings
if( $ratings[0] || $ratings[1] )
{
if( $ratings[0] && $ratings[1] )
{
//only use the first rating because if there's more than one that's bullshit.
$oneRate = Base::toArray($ratings[0]);
$oneRate = $oneRate[0];
$twoRate = Base::toArray($ratings[1]);
$twoRate = $twoRate[0];
if( $oneRate == 0 )
{
$oneRate = .0000000000000001;
}
if( $twoRate == 0 )
{
$twoRate = .0000000000000001;
}
$oneRate = 1 / $oneRate->rating;
$twoRate = 1 / $twoRate->rating;
$diff = $oneRate - $twoRate;
}
else
{
//one item doesn't have ratings
//don't do anything right now.
}
$willTheyLikeTwoComparedToOne += $diff * .1;
}
else
{
//no ratings for either item
}
//try to compare number of views
//people are more likely to view something if they want it (even subconsciously)
//so the comparison of views could offer a rough estimate
if( $views[0] || $views[1] )
{
if( $views[0] && $views[1] )
{
//get counts
$vwOne = count(Base::toArray($views[0]));
$vwTwo = count(Base::toArray($views[1])); // ah, vwTwo, the most difficult Pokemon to catch.
//close or equal
if( ( $vwTwo - 1 < $vwOne ) && ( $vwTwo < $vwTwo + 1 ) )
{
//bump up the likelihood
$willTheyLikeTwoComparedToOne += .05;
}
elseif( $vwTwo < $vwOne )
{
//maybe not
$willTheyLikeTwoComparedToOne -= .05;
}
else
{
//very likely
$willTheyLikeTwoComparedToOne += .1;
}
}
else
//.........这里部分代码省略.........
示例8: toArray
/**
* Returns the item values as array.
*
* @return array Associative list of item properties and their values.
*/
public function toArray()
{
$list = parent::toArray();
$price = $this->price;
$list['order.base.service.baseid'] = $this->getBaseId();
$list['order.base.service.code'] = $this->getCode();
$list['order.base.service.serviceid'] = $this->getServiceId();
$list['order.base.service.name'] = $this->getName();
$list['order.base.service.mediaurl'] = $this->getMediaUrl();
$list['order.base.service.type'] = $this->getType();
$list['order.base.service.price'] = $price->getValue();
$list['order.base.service.costs'] = $price->getCosts();
$list['order.base.service.rebate'] = $price->getRebate();
$list['order.base.service.taxrate'] = $price->getTaxRate();
return $list;
}
示例9: toArray
public function toArray($columns = null)
{
$output = parent::toArray($columns);
unset($output['user_password']);
$output['user_profile'] = $this->profile->toArray();
return $output;
}