本文整理汇总了PHP中Area::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Area::toArray方法的具体用法?PHP Area::toArray怎么用?PHP Area::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area::toArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
* POST /area
*
* @return Response
*/
public function store()
{
$V = Validator::make(Input::all(), ['name' => 'required|string']);
if ($V->fails()) {
return Response::json($V->messages()->all(), 400);
}
$name = Input::get('name');
$Area = Area::where('name', '=', $name);
if ($Area->count() > 0) {
// already exists :/
return Response::json($Area->toArray(), 409);
}
$NewArea = new Area();
$NewArea->name = $name;
$NewArea->save();
return Response::json($NewArea->toArray(), 201);
}
示例2: toArray
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['FreeShipping'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['FreeShipping'][$this->getPrimaryKey()] = true;
$keys = FreeShippingTableMap::getFieldNames($keyType);
$result = array($keys[0] => $this->getId(), $keys[1] => $this->getAreaId(), $keys[2] => $this->getAmount());
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}
示例3: toArray
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['SocolissimoPrice'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['SocolissimoPrice'][$this->getPrimaryKey()] = true;
$keys = SocolissimoPriceTableMap::getFieldNames($keyType);
$result = array($keys[0] => $this->getId(), $keys[1] => $this->getAreaId(), $keys[2] => $this->getDeliveryModeId(), $keys[3] => $this->getWeightMax(), $keys[4] => $this->getPrice());
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->aSocolissimoDeliveryMode) {
$result['SocolissimoDeliveryMode'] = $this->aSocolissimoDeliveryMode->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}
示例4: toArray
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['TntPriceWeight'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['TntPriceWeight'][$this->getPrimaryKey()] = true;
$keys = TntPriceWeightTableMap::getFieldNames($keyType);
$result = array($keys[0] => $this->getId(), $keys[1] => $this->getAreaId(), $keys[2] => $this->getTntProductLabel(), $keys[3] => $this->getTntProductCode(), $keys[4] => $this->getWeight(), $keys[5] => $this->getPrice(), $keys[6] => $this->getPriceKgSup(), $keys[7] => $this->getCreatedAt(), $keys[8] => $this->getUpdatedAt());
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}