/**
  * Add monitoring of the propel object by the user
  *
  * @return void
  * @param  BaseObject  $object
  * @param  int         $user_id  User primary key
  **/
 public function addMonitoringUser(BaseObject $object, $user_id)
 {
     if (is_null($user_id) or trim((string) $user_id) === '') {
         throw new deppPropelActAsMonitorableException('Impossible to allow a user monitoring with no user primary key provided');
     }
     // add the record
     $monitoring_object = new Monitoring();
     $monitoring_object->setMonitorableModel(get_class($object));
     $monitoring_object->setMonitorableId($this->getReferenceKey($object));
     $monitoring_object->setUserId($user_id);
     $ret = $monitoring_object->save();
     // update the caches
     $user = call_user_func_array(array($this->getMonitorerModel($object) . "Peer", 'retrieveByPK'), array($user_id));
     $user->countMonitoredObjects(get_class($object), null, true);
     $this->countMonitoringUsers($object, true);
 }
 public function create_post($property_id)
 {
     if (is_null(Property::find($property_id))) {
         return Redirect::to('admin/properties')->with('error', 'Property was not found.');
     }
     $property = Property::find($property_id);
     $validator = Validator::make(Input::all(), Monitoring::$rules);
     if ($validator->fails()) {
         return Redirect::to(URL::current())->withErrors($validator)->withInput();
     } else {
         $monitoring = new Monitoring();
         $monitoring->property_id = $property_id;
         $monitoring->block = Input::get('block');
         $monitoring->lot = Input::get('lot');
         $monitoring->status = Input::get('status');
         $monitoring->save();
         return Redirect::to(URL::current())->with('success', 'Block has been added');
     }
 }