Search Results

Search found 13276 results on 532 pages for 'yii framework'.

Page 50/532 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Entity Framework: Attached Entities not Saving

    - by blog
    Hello: I can't figure out why calling SaveChanges() on the following code results in no changes to the objects I attached: // delete existing user roles before re-attaching if (accountUser.AccountRoles.Count > 0) { foreach (AccountRole role in accountUser.AccountRoles.ToList()) { accountUser.AccountRoles.Remove(role); } } // get roles to add List<int> roleIDs = new List<int>(); foreach (UserRole r in this.AccountRoles) { roleIDs.Add(r.RoleID); } var roleEntities = from roles in db.AccountRoles where roleIDs.Contains(roles.id) select roles; accountUser.AccountRoles.Attach(roleEntities); db.SaveChanges(); In the debugger, I see that the correct roleEntities are being loaded, and that they are valid objects. However, if I use SQL Profiler I see no UPDATE or INSERT queries coming in, and as a result none of my attached objects are being saved.

    Read the article

  • How to style forms in the Zend framework?

    - by user505988
    Hi, I really like the idea of putting forms into a seperate class that manages validation etc, but I don't like everything ending up in a DL and also not being able to use square bracket notation in post elements like <input type='checkbox' name='data[]'>. Is there another way of generating forms - like in views so I can style them the way I want, but also keeping the validation aspect? Also how would I load this view into my current view (using partial view somehow?)

    Read the article

  • Zend Framework 1.1 Modules setup

    - by jiewmeng
    i used zend_tool to setup a project then to create module blog with index controller etc but i guess the default config setup by zend_tool does not work with modules so i edited it resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.moduleDirectoryControllerName = "controllers" i guess these are required for modules? also i moved the folders, controllers, models, views into the modules/ folder but i get a blank screen when i try to go to http://servername which shld load Default module's index controller and action. even if i try to go http://servername/nonexistentpage it also shows a blank screen instead of a 404

    Read the article

  • Entity Framework with SQL Server 2000 (APPLY Operator) issue

    - by How Lun
    Hello, I have a simple Linq query below: var seq = (from n in GetObjects() select n.SomeKey) .Distinct() .Count(); This query works find with SQL Server 2005 and above. But, this start to give headache when I hooked the EF to SQL Server 2000. Because EF is using APPLY operator which only SQL Server 2005 and above can be supported. I do not know why the hell EF is using APPLy operator instead of sub queries. My current work around is: var seq = (from n in GetObjects() select n.SomeKey) .Distinct() .ToList() .Count(); But, I can forsee more problems to come. The above query is just a simple one. Did anyone come across such issue? And how you guys work around it? Or is there a way to force EF not to use APPLY operator? Any help will be very much appreciated. How Lun.

    Read the article

  • Add Page Parameter in Zend Framework Doesn't Work

    - by deerawan
    Hello guys, I've been trying to figure this out these days. I got a problem when I want to add 'page' parameter in my URL for my pagination. This is my router -addRoute('budi',new Zend_Controller_Router_Route(':lang/budi',array('controller' = 'budi', 'action' = 'index', 'page' = 1), array('lang'=$s, 'page' = '\d+'))) -addRoute('budi1',new Zend_Controller_Router_Route(':lang/budi/page/:page',array('controller' = 'budi', 'action' = 'index', 'page' = 1), array('lang'=$s, 'page' = '\d+'))) Then I access my URL http://localhost/learningsystem/en/budi but when I hover on my pagination links, the page parameter doesn't appear. The URL is still http://localhost/learningsystem/en/budi but if I enter same URL with index in the end like this one http://localhost/learningsystem/en/budi/index or like this one http://localhost/learningsystem/en/budi/page/1 the page parameter appears perfectly when I click the page 2 link http://localhost/learningsystem/en/budi/index/page/2 Actually, I don't want include 'index' or 'page' at first in my URL. Anyway, I use default pagination.phtml template from Zend. Anyone please help me to solve this problem? Thank you very much

    Read the article

  • How to implement table-per-concrete-type using entity framework

    - by SDReyes
    Hello Guys! I'm mapping a set of tables that share a common set of fields: So as you can see I'm using a table-per-concrete-type strategy to map the inheritance. But... I have not could to relate them to an abstract type containing these common properties. It's possible to do it using EF? BONUS: The only non documented Entity Data Model Mapping Scenario is Table-per-concrete-type inheritance http://msdn.microsoft.com/en-us/library/cc716779.aspx : P

    Read the article

  • Entity framework Update fails when object is linked to a missing child

    - by McKay
    I’m having trouble updating an objects child when the object has a reference to a nonexising child record. eg. Tables Car and CarColor have a relationship. Car.CarColorId CarColor.CarColorId If I load the car with its color record like so this var result = from x in database.Car.Include("CarColor") where x.CarId = 5 select x; I'll get back the Car object and it’s Color object. Now suppose that some time ago a CarColor had been deleted but the Car record in question still contains the CarColorId value. So when I run the query the Color object is null because the CarColor record didn’t exist. My problem here is that when I attach another Color object that does exist I get a Store update, insert error when saving. Car.Color = newColor Database.SaveChanges(); It’s like the context is trying to delete the nonexisting color. How can I get around this?

    Read the article

  • [Zend Framework] Forms and success output

    - by rasouza
    Well, It's a beginer's question but I really don't know what is the best way. I have a basic CRUD (Create, Retrieve, Update and Delete) in my project and I'd like to output some message if succeded or not in a div inside the same page. So, basically, I have a form which action is setted to the same page and I have a div #statusDiv below this same form which I'd like to output something like Register included with success. What is the best way for doing this? Set a flag in the controller $this->view->flagStatus = 'message' then call it in the view? Just to make it more clear. It's my code: //IndexController.php indexAction() ... //Check if there's submitted data if ($this->getRequest()->isPost()) { ... $registries->insert($data); $this->view->flagStatus = 'message'; $this->_redirect('/'); } Then my view: .... <?php if ($this->flagStatus) { ?> <div id="divStatus" class="success span-5" style="display: none;"> <?php echo $this->flagStatus; ?> </div> <?php } ?> ....

    Read the article

  • Question creating PDF document in Zend Framework

    - by deaddancer
    I need to take a ZF rendered view and create a PDF that should look pretty much exactly the same, and email it. The major issue I have right now is getting the HTML created by the view into a string that I can then process with the Zend_PDF::parse method. The view I need to turn into a PDF is the result of a posted form. I've tried grabbing the contents of ob_get_contents into a string after a successful post, but for some reason its not in there. Should I press on with this angle? Any help would be greatly appreciated!

    Read the article

  • Pass a variable from postDispatch() to view instance in Zend Framework

    - by takeshin
    I have a controller plugin with postDispatch() hook, and there I have a $variable. How to pass this variable to the view instance? I tried Zend_Layout::getMvcInstance()->getView(), but this returns new view instance (not the application resource). The same with $bootstrap->getResource('view'). I don't want to pass it as a request param. Now, as a workaround I do it using Zend_Registry. But, is it the best way?

    Read the article

  • How to retrieve base class only (entity framework)?

    - by Juvaly
    Hi All, I've been scratching my head here for a while now... I have a Consumer class and a BillableConsumer class that inherits Consumer. They are both a part of the Consumers set. The problem is that this following query: Consumer consumer = (from c in _ctx.Consumers where c.ID = id select c).First(); returns a BillableConsumer instance! Just the same as this query: BillableConsumer bconsumer = (from c in _ctx.Consumers.OfType<BillableConsumer>() where c.ID = id select c).First(); How can I return an instance of just the base class? (these are separate tables in the data store).

    Read the article

  • How to handle Foreign Keys with Entity Framework

    - by Jack Marchetti
    I have two entities. Groups. Pools. A Group can create many pools. So I setup my Pool table to have a GroupID foreign key. My code: using (entity _db = new entity()) { Pool p = new Pool(); p.Name = "test"; p.Group.ID = "5"; _db.AddToPool(p); } This doesn't work. I get a null reference exception on p.Group. How do I go about creating a new "Pool" and associating a GroupID?

    Read the article

  • Entity Framework 4 and 0:1, 0:1 relationships

    - by Eric J.
    I'm using the Model First approach with EF 4 and hit a snag with two tables, Participant (singular because pre-existing from another app) and ActiveParticipants. A Participant may or may not be associated with exactly one ActiveParticipant and vice versa. When I create an association, everything seems to go well on the surface, but then I get a runtime error complaining that Participant does not contain the column ActiveParticipant_Id. It does contain a column ActiveParticipantId (no underscore). When I view the diagram as XML, there's a line like this: <Property Name="ActiveParticipant_Id" Type="uniqueidentifier" Nullable="true" /> Why is it adding an underscore? Is there anything special I need to do for 0:1, 0:1 relationships?

    Read the article

  • .NET Compact Framework app that will run on both Professional and Standard

    - by CJCraft.com
    Is there any guidance on creating apps that will run on both professional (touch-screen) and standard (non-touch-screen) devices. I have a simple application that is mostly text and buttons that in theory should be able to run on both professional and standard devices with little if any modification. It seems the IDE wants to make this hard to impossible, but I expect it to be possible. Any advice?

    Read the article

  • Left Join with Entity Framework

    - by sanfra1983
    hi, someone can tell me how to do this query in EF1: select a.idAnimali, a.titolo, a.commenti, a.ordine, a.idcatanimali, table1.nomefoto FROM tabanimali as a LEFT JOIN (SELECT idanimali, nomefoto tabfotoanimali FROM LIMIT 1) AS Table1 On a.idAnimali = table1.idanimali WHERE a.idcatanimali = idcatanimale Thanks

    Read the article

  • Does Entity Framework saves related classes automatically?

    - by herbatnic
    Let's assume that we have such classes public class A{ string someField { get; set; } public virtual B B {get; set; } } public class B { int someIntField {get; set; } [ForeignKey("Id")] [Required] public virtual A A { get; set; } } In code I create new instances for both of them and making relation like: A a = new A () { someField = "abcd"}; B b = new B () { someIntField = 42 }; A.B = b; B.A = a; Should I using DBContext to save both classes like that: using (var db = new myDbContext()) { myDbContext.As.Add(A); myDbContext.Bs.Add(B); myDBContext.SaveChanges(); } Or saving it like that: using (var db = new myDbContext()) { myDbContext.As.Add(A); myDbContext.SaveChanges(); } is enough to store related objects into database?

    Read the article

  • Zend Framework How can I print a logged in user name from a Zend_Session_Namespace

    - by IrishStudent76
    Hi all I have created the following login controller for my site and it works fine in relation to logging users in a logging them out. The thing I want to do is echo the logged in users name into the FlashMessenger for the success page how ever as my code stands I only get the following message when redirected to the success page, "you have been successfully logged in as Array". Can I also ask the following does the line $session-user =$adaptergetResultArray('Password'); create an array of user information less the password value from the database. Many Thanks in advance, IrishStudent76 <?php class LoginController extends Zend_Controller_Action { public function init(){ $this->view->doctype('XHTML1_STRICT'); } // login action public function loginAction() { $form = new PetManager_Form_Login; $this->view->form = $form; /* check for valid input from the form and authenticate using adapter Add user record to session and redirect to the original request URL if present */ if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $values = $form->getValues(); $adapter = new PetManager_Auth_Adapter_Doctrine( $values['username'], $values['password'] ); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($adapter); if ($result->isValid()) { $session = new Zend_Session_Namespace('petmanager.auth'); $session->user = $adapter->getResultArray('Password'); if (isset($session->requestURL)) { $url = $session->requestURL; unset($session->requestURL); $this->_redirect($url); } else { $this->_helper->getHelper('FlashMessenger') ->addMessage('You have been successfully logged in as '.$session- >user); $this->_redirect('/login/success'); } } else { $this->view->message = 'You could not be logged in. Please try again.'; } } } } public function successAction() { if ($this->_helper->getHelper('FlashMessenger')->getMessages()) { $this->view->messages = $this->_helper ->getHelper('FlashMessenger') ->getMessages(); } else { $this->_redirect('/login'); } } public function logoutAction() { Zend_Auth::getInstance()->clearIdentity(); Zend_Session::destroy(); $this->_redirect('/'); } }

    Read the article

  • What is the difference between these two statements (asp.net/c#/entity framework)

    - by user318573
    IEnumerable<Department> myQuery = (from D in myContext.Departments orderby D.DeptName select D); var myQuery = (from D in myContext.Departments orderby D.DeptName select D); What is the difference between these two statements above? In my little asp.net/C#/ EF4.0 app I can write them either way, and as far as how I want to use them, they both work, but there has to be a reason why I would choose one over the other?

    Read the article

  • Zend Framework: Navigation XML and duplicate page elements

    - by jakenoble
    Hi In XML I'd normal expect the following to be perfectly valid and navigable in a meaningful way using something like PHP's DomDocument: <?xml version="1.0" encoding="UTF-8"?> <configdata> <page> <name>Home</name> </page> <page> <name>Log in</name> </page> </configdata> This is not the case when using Zend_Navigation. Each <page> element needs to have a unique name, so you would need to do: <?xml version="1.0" encoding="UTF-8"?> <configdata> <page_home> <name>Home</name> </page_home> <page_log_in> <name>Log in</name> </page_log_in> </configdata> This works, but is very annoying. I'd much rather have multiple page elements which can have the same name and can be easily copy and pasted when creating many pages for navigation. Why does each one need a unique name? Is there a way of not having to have a unique name?

    Read the article

  • multiple join query in entity framework

    - by gvLearner
    I have following tables tasks id | name | proj_id 1 | task1 | 1 2 | task2 | 1 3 | task3 | 1 projects id | name 1 | sample proj1 2 | demo project budget_versions id | version_name| proj_id 1 | 50 | 1 budgets id | cost | budget_version_id | task_id 1 | 3000 | 1 | 2 2 | 5000 | 1 | 1 I need to join these tables to get a result as below task_id | task_name | project_id | budget_version | budget_id | cost 1 | task1 | 1 | 1 | 2 |5000 2 | task2 | 1 | 1 | 1 |3000 3 | task3 | 1 | NULL | NULL |NULL select tsk.id,tsk.name, tsk.project_id, bgtver.id, bgt.id, bgt.cost from TASK tsk left outer join BUDGET_VERSIONS bgtver on tsk.project_id= bgtver.project_id left outer join BUDGETS bgt on bgtver.id = bgt.budget_version_id and tsk.id = bgt.task_id where bgtver.id = 1

    Read the article

  • Getting an Ajax response from Zend Framework Controller

    - by JavaLava
    I'm doing an Ajax request on one of my views to a Controller but I am unable to send back a response to the Ajax method. In the snippet below, I am trying to send the word 'hellopanda' back but in the alert message, I'll get data as an object. View : $.ajax({ type: "POST", url: "localhost/some-activity", data: dataString, success: function(data) { alert( "Data is: " + data); //do something with data }, error: function(data){ alert( "Data is: " + data); //do something with data }, onComplete: function(){ } }); Controller: public function someActivityAction(){ //do stuff echo "hellopanda"; } I'm pretty sure the echo is the problem. Any insights on to how to do a proper response to the view would be greatly appreciated.

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >