Jump to content

244863

Members
  • Posts

    54
  • Joined

  • Last visited

About 244863

  • Birthday 08/16/1986

Profile Information

  • Gender
    Male
  • Location
    Gloucester
  • Age
    26

244863's Achievements

Member

Member (2/5)

0

Reputation

  1. I have the following roles: Admin Client Contractor I want to create a new one called Client_site. I want this to route through to the Client prefix's but have different ACL. Basically I want it to use all the same pages, just have read only access to them. How would I set this up in the routing? Also is there anything else I will need to amend to get this working?
  2. app/lib/Cake/Model/Model.php Line 1963 I wrapped the updateAll function with: if (!empty($keys[$foreignKey])) { Works a treat.
  3. Hi, Addresses -> $hasMany -> Users Users -> $belongsTo -> Addresses I do not need a UserAddresses table as that would suggest a HABTM relationship which is not needed here. All I want to know is why the counterCache is trying to update when I use the $this->Model->delete() and not when I use $this->Model->save when the foreign_key is NULL???
  4. Yes as I wanted to make the DB relational so I split the tables so an Address hasMany Users. This is for a building management issue logging system. So we may have 40 people that work out of one building at one address that need to log building issues. For example: My light bulb needs replacing. Thanks,
  5. Sorry got myself all in a muddle, it should of read... "No, it is the counterCache which is trying to do the UPDATE. I have 3 functions in my UsersController: add which does a $this->User->save() edit which does a $this->User->save() delete which does a $this->User->delete() when I use the delete function, it deletes the User. But the counterCache tries to UPDATE the user_count field on the Addresses table with an id of NULL. The save()'s on the add / edit do not produce this error and run correctly. Hope this explains it better." Sorry.
  6. Hi, No, it is the counterCache which is trying to do the UPDATE. I have 3 functions in my UsersController: add which does a $this->User->save() edit which does a $this->User->save() delete which does a $this->User->delete() when I use the delete function, it deletes the User. But the counterCache tries to UPDATE the address_count field on the Users table with an id of NULL. The save()'s on the add / edit do not produce this error and run correctly. Hope this explains it better.
  7. I have just looked into it more and I only seem to get the error when deleting. It does not come up when adding / editing??
  8. Any ideas on what? I have been trying everything I can think of...
  9. Hi, I have a belongsTo relationship with a counterCache set correctly. The problem being that this relationship is not always there. For example Users don't always have a link to an address so the DB allows nulls. But the counterCache is always trying to update, even when the foreign key is NULL. E.g. UPDATE [addresses] SET [user_count] = 0 WHERE [id] IS N'' Is there something I can put into the counterScope to stop this error from happening on NULL id's?? Thanks in advance.
  10. Hi, Tried this in my app controller's before filter: $this->Security->unlockFields = array('DocumentationDocument.site_id'); still does not work, unless I uncomment that line of code???
  11. 244863

    export to csv

    Hi, Went with this in the end. $this->set('account_status', $this->Report->query("SELECT * FROM report_account_status AS Report;")); $this->layout = 'csv/default'; Thanks,
  12. 244863

    Cakephp ACL

    Hi, The answer was because Apache was looking at a different PHP ini file, so could not connect through the command line. Thanks,
  13. Here is the code for my view: <div class="column span-24"> <div class="box"> <?php echo $this->html->tag('h2', $title_for_layout); echo $this->form->create('DocumentationDocument', array('action' => 'add', 'type' => 'file')); echo $this->form->inputs(array( 'File' => array( 'type' => 'file', 'label' => __('Local File', true), 'required' => true ), 'site_id' => array( 'type' => 'hidden' ), 'site_name' => array( 'class' => 'site_name span-8', 'type' => 'text', 'required' => true, 'between' => $this->html->tag( 'div', $this->html->para('notice', __('Begin typing the site name and choose from the resultant list.', true)), array('class' => 'field-description') ) ), 'documentation_category_id' => array( 'empty' => '...', 'class' => 'span-8', 'required' => true ), 'asset_category_id' => array( 'empty' => '...', 'class' => 'span-8', 'required' => true ), 'date_produced' => array('type' => 'date') )); echo $this->html->para('notice', sprintf("Maximum file size: $size_limit")); echo $this->element('standard-form-buttons'); ?> </div> </div> <?php echo $this->element('sites', array(), array('cache' => true)); echo $this->html->scriptBlock(' $(function() { $(".site_name").autocomplete(sites, { dataType: "json", matchContains: true, mustMatch: true, parse: function(data) { return $.map(data, function(row) { return { data: row, value: row.display_name, result: row.display_name } }); }, formatItem: function(item) { return item.display_name; }, formatResult: function(item) { return item.display_name; } }).result(function(event, data, formatted) { if (data && data.id) { allSites = $(".site", $("#sites")); index = allSites.index($(this).closest(".site")); $("#DocumentationDocumentSiteId").val(data.id); $(this).siblings(".error-message").hide(100).parent().removeClass("error"); } }); }); ', array('inline' => false)); $this->Form->unlockField('DocumentationDocument.site_id'); echo $this->form->end(); ?> If I remove the following line of JS the page posts fine: $("#DocumentationDocumentSiteId").val(data.id); I am pretty sure I have the unlockedField line correct as it works on other pages. Any ideas as to why it won't post? Thanks,
  14. 244863

    Cakephp ACL

    It says the same thing: Database connection "Mysql" is missing????
  15. 244863

    Cakephp ACL

    Yes, my whole site works fine. It is just the plugin that does not like it. I have a feeling it is to do with the default database connection using a Datasource of Database/Sqlserver and the plugin not liking / finding the file location. But I'm not sure how to test / change it too????
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.