本文整理汇总了PHP中Property::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::save方法的具体用法?PHP Property::save怎么用?PHP Property::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created kin in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Property::$rules, Property::$messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$property = new Property();
$property->employee_id = Input::get('employee_id');
$property->name = Input::get('name');
$property->description = Input::get('desc');
$property->serial = Input::get('serial');
$property->digitalserial = Input::get('dserial');
$property->monetary = Input::get('amount');
$property->issued_by = Confide::user()->id;
$property->issue_date = Input::get('idate');
$property->scheduled_return_date = Input::get('sdate');
if (filter_var(Input::get('active'), FILTER_VALIDATE_BOOLEAN)) {
$property->state = 1;
$property->received_by = Confide::user()->id;
$property->return_date = Input::get('idate');
} else {
$property->state = 0;
$property->received_by = 0;
$property->return_date = null;
}
$property->save();
Audit::logaudit('Properties', 'create', 'created: ' . $property->name);
return Redirect::route('Properties.index')->withFlashMessage('Company property successfully created!');
}
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Property();
$fsUtil = new FileSystemUtil();
if (isset($_POST['Property'])) {
$model->attributes = $_POST['Property'];
if ($model->save()) {
//creo el directorio para las imagenes del inmueble
$fsUtil->createPropertyFoderIfNotExists($model->id);
//guardo las imagenes para el inmueble
$images = $fsUtil->getTmpFilesNames();
foreach ($images as $img) {
$imgInm = new ImagenProperty();
$imgInm->id_inmueble = $model->id;
$imgInm->ruta = $img;
if ($imgInm->save()) {
$fsUtil->copyFileFromTmpToFs($imgInm->ruta, $model->id);
}
}
$this->audit->registrarAuditoria(Yii::app()->user->id, new DateTime(), Constants::AUDITORIA_OBJETO_INMUEBLE, Constants::AUDITORIA_OPERACION_ALTA, $model->id);
$this->render('/site/successfullOperation', array('header' => 'Inmueble creado con éxito', 'message' => 'Haga click en volver para regresar a la gestión de inmuebles', 'returnUrl' => Yii::app()->createUrl('inmueble/admin'), 'viewUrl' => Yii::app()->createUrl("inmueble/view", array("id" => $model->id))));
return;
}
}
$fsUtil->clearUserTmpFolder();
$this->render('create', array('model' => $model));
}
示例3: store
/**
* Store a newly created resource in storage.
* POST /properties
*
* @return Response
*/
public function store()
{
$input = Input::all();
$v = Validator::make(Input::All(), array('name' => 'required|max:50|', 'description' => 'required|max:400|min:10', 'ownerID' => 'required'));
if ($v->passes()) {
$agent_id = Sentry::getUser()->id;
$property = new Property();
$property->name = Input::get('name');
$property->description = Input::get('description');
$property->ownerID = Input::get('ownerID');
$property->agent_id = $agent_id;
$property->save();
$newprop = Property::where('name', Input::get('name'))->first();
$newprop_id = $newprop->id;
foreach (Input::get('CBgroup1', array()) as $value) {
$housedue = new Housedue();
$housedue->propertyID = $newprop_id;
$housedue->receivable = $value;
$converted = strtolower(preg_replace("/[[:blank:]]+/", "_", $value));
$housedue->db_name = $converted;
$housedue->save();
}
return Redirect::intended('admin/property');
}
return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
}
示例4: actionCreate
/**
* Creates a new Property model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Property();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->property_id]);
} else {
return $this->render('create', ['model' => $model]);
}
}
示例5: set
/**
* Shorthand to create or update properties
*
* @return void
* @author Carlos Escribano <carlos@markhaus.com>
**/
public static function set($key, $value)
{
if (!($p = Doctrine::getTable('Property')->findOneBy('keey', $key))) {
$p = new Property();
$p->setKeey($key);
}
$p->setValue($value);
$p->save();
}
示例6: test_deletion_from_collection_should_destroy_the_active_record
public function test_deletion_from_collection_should_destroy_the_active_record()
{
$Property = new Property(array('description' => 'This is a Property'));
$Picture = $Property->picture->create(array('title' => 'Front'));
$this->assertTrue($Property->save());
$this->assertTrue($Picture instanceof AkActiveRecord);
$Property->picture->delete($Picture);
$StoredProperty = $this->Property->find('first');
$this->assertEqual($Property->getId(), $StoredProperty->getId());
$this->assertFalse($this->Picture->find('first', array('default' => false)));
}
示例7: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Property();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Property'])) {
$model->attributes = $_POST['Property'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例8: setUp
public function setUp()
{
Yii::app()->db->createCommand()->truncateTable('link_client_to_instruction');
Yii::app()->db->createCommand()->truncateTable('property');
Yii::app()->db->createCommand()->truncateTable('deal');
Yii::app()->db->createCommand()->truncateTable('client');
Yii::app()->db->createCommand()->truncateTable('currentPropertyOwner');
Yii::app()->db->createCommand()->truncateTable('cli2off');
Yii::app()->db->createCommand()->truncateTable('offer');
$this->migration = new m121127_103823_populate_currentPropertyOwners_table();
$this->migration->down();
$this->property = new Property();
$this->property->save(false);
$this->assertInstanceOf('Property', $this->property);
$this->owner1 = new Client();
$this->owner1->save(false);
$this->owner2 = new Client();
$this->owner2->save(false);
$this->owner3 = new Client();
$this->owner3->save(false);
$this->owner4 = new Client();
$this->owner4->save(false);
}
示例9: store
/**
* Store a newly created resource in storage.
* POST /properties
*
* @return Response
*/
public function store()
{
$input = Input::all();
$v = Validator::make(Input::All(), array('name' => 'required|max:50|', 'description' => 'required|max:400|min:10', 'ownerID' => 'required'));
if ($v->passes()) {
$agent_id = Sentry::getUser()->id;
$property = new Property();
$property->name = Input::get('name');
$property->description = Input::get('description');
$property->ownerID = Input::get('ownerID');
$property->agent_id = $agent_id;
$property->save();
return Redirect::intended('admin/property');
}
return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
}
示例10: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aDomain !== null) {
if ($this->aDomain->isModified() || $this->aDomain->isNew()) {
$affectedRows += $this->aDomain->save($con);
}
$this->setDomain($this->aDomain);
}
if ($this->aProperty !== null) {
if ($this->aProperty->isModified() || $this->aProperty->isNew()) {
$affectedRows += $this->aProperty->save($con);
}
$this->setProperty($this->aProperty);
}
if ($this->aUser !== null) {
if ($this->aUser->isModified() || $this->aUser->isNew()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例11: edit
/**
* if $_GET['owner'] is passed that means that proeprty will have an owner before it is created.
* it is used in situation when wi select a client and want to create a property for him (valuation for example) then it is obvious that client is an owner
*
* @param Property $model property to edit
*/
public function edit(Property $model)
{
/**
* @var $address Address
*/
if (isset($_POST['Property']) && $_POST['Property']) {
$model->attributes = $_POST['Property'];
$model->setClients(isset($_POST['owner']) && $_POST['owner'] ? $_POST['owner'] : [], Property::CLIENT_TYPE_OWNER);
$model->setClients(isset($_POST['tenant']) && $_POST['tenant'] ? $_POST['tenant'] : [], Property::CLIENT_TYPE_TENANT);
if (isset($_POST['propertyAddress']['id']) && $_POST['propertyAddress']['id']) {
$address = Address::model()->findByPk($_POST['propertyAddress']['id']);
if ($address) {
$model->setAddress($address);
}
}
if ($model->save()) {
Yii::app()->user->setFlash('property-update-success', 'Property updated.');
$url = array('update', 'id' => $model->pro_id);
if (isset($_GET['nextStep']) && $_GET['nextStep']) {
if (isset($_POST['proceed'])) {
if ($_GET['nextStep'] == 'AppointmentBuilder_propertySelected') {
}
$url = $this->createUrl('AppointmentBuilder/propertySelected', ['propertyId' => $model->pro_id]);
} else {
$url['nextStep'] = $_GET['nextStep'];
}
}
$this->redirect($url);
}
}
$suggesstedOwner = null;
if (Yii::app()->user->hasFlash('suggest-new-owner')) {
$suggesstedOwner = Client::model()->findByPk(Yii::app()->user->getFlash('suggest-new-owner', null, false));
}
$this->render('edit', ['model' => $model, 'suggestedOwner' => $suggesstedOwner]);
}
示例12: test_scope_for_multiple_member_deletion
public function test_scope_for_multiple_member_deletion()
{
$PisoJose = new Property('description->', 'Piso Jose');
$PisoBermi = new Property('description->', 'Piso Bermi');
$Atico = new PropertyType('description->', 'Ático');
$Apartamento = new PropertyType('description->', 'Apartamento');
$this->assertTrue($PisoJose->save() && $PisoBermi->save() && $Atico->save() && $Apartamento->save());
$PisoJose->property_type->add($Atico);
$PisoJose->property_type->add($Apartamento);
$PisoBermi->property_type->add($Atico);
$PisoBermi->property_type->add($Apartamento);
$this->assertTrue($PisoJose =& $PisoJose->findFirstBy('description', 'Piso Jose'));
$this->assertTrue($Atico =& $Atico->findFirstBy('description', 'Ático'));
$PisoJose->property_type->load();
$PisoJose->property_type->delete($Atico);
$this->assertTrue($PisoBermi =& $PisoBermi->findFirstBy('description', 'Piso Bermi'));
$this->assertTrue($PisoJose =& $PisoJose->findFirstBy('description', 'Piso Jose'));
$PisoJose->property_type->load();
$this->assertTrue($Atico =& $Atico->findFirstBy('description', 'Ático'));
$this->assertTrue($Apartamento =& $Apartamento->findFirstBy('description', 'Apartamento'));
$this->assertEqual($PisoJose->property_types[0]->getId(), $Apartamento->getId());
$this->assertEqual($PisoBermi->property_type->count(), 2);
}
示例13: Database
<?php
include_once 'config/database.php';
include_once 'repository/Property.php';
$database = new Database();
$db = $database->getConnection();
$property = new Property($db);
$property->name = $_POST['name'];
$property->address = $_POST['address'];
$property->save();
print $property->name;
示例14: do_update
/**
* Updates a property
*
* @param int $id The property ID
* @param array $data
* @return int The property ID
*/
public function do_update($id, $data = null)
{
$user = $this->requireUser();
if (!$user->isAdmin()) {
throw new Exception('Only administrators are allowed to edit properties.');
}
// Validate input data
$validator = new KickstartValidator();
$locale = Localizer::getInstance();
$warnings = $validator->filterErrors($data, $this->initFilter($this->filter_basic, $locale));
if ($warnings) {
return array('result' => false, 'warnings' => $warnings);
}
$query = PropertyQuery::create()->filterByAccount($user->getAccount());
if ($id !== null) {
$query->filterById($id, Criteria::NOT_EQUAL);
$property = PropertyQuery::create()->filterByAccount($user->getAccount())->findOneById($id);
if (!$property) {
throw new Exception('Property not found; ID: ' . $id);
}
} else {
$property = new Property();
}
// Check for duplicates
if (isset($data['Name']) and $query->findOneByName($data['Name'])) {
throw new Exception($locale->insert('error.taken', array('value' => '"' . $data['Name'] . '"')));
}
unset($data['Id']);
$property->fromArray($data);
$property->setAccount($user->getAccount());
$property->save();
return $property->getId();
}
示例15: createProperty
public function createProperty()
{
$input = Input::all();
$v = Validator::make(Input::All(), array('name' => 'required|max:50|', 'ownerID' => 'required', 'CBgroup1' => 'required', 'agent_id' => 'required'));
if ($v->passes()) {
$agent_id = Input::get('agent_id');
$properties = Owner::where('agent_id', $agent_id)->get();
if (!$properties->isEmpty()) {
$property = new Property();
$property->name = Input::get('name');
$property->ownerID = Input::get('ownerID');
$property->agent_id = $agent_id;
$property->save();
$newprop = Property::where('name', Input::get('name'))->first();
$newprop_id = $newprop->id;
$payment = Input::get('CBgroup1');
$fields = preg_split("/[\\s,]+/", $payment);
$arrlength = count($fields);
for ($x = 0; $x < $arrlength; $x++) {
$housedue = new Housedue();
$housedue->propertyID = $newprop_id;
$converted = ucfirst(preg_replace("/[[:blank:]]+/", " ", $fields[$x]));
$housedue->receivable = $converted;
$housedue->db_name = $fields[$x];
$housedue->save();
}
$noteProperty2 = array('error' => false, 'message' => 'Property Created Successfully');
return $noteProperty2;
}
$noteProperty3 = array('error' => true, 'message' => 'Only owners are allowed to create properties');
return $noteProperty3;
}
$noteProperty4 = array('error' => true, 'message' => $v->messages());
return $noteProperty4;
}