$saveStatus = 1;
$conn = ConnectionManager::get('default');
$conn->begin();
$tableArticles = TableRegistry::get('Articles');
$tableUsers = TableRegistry::get('Users');
$articlesEntity = $tableArticles->newEntities($categoriesArray);
foreach ($articlesEntity as $entity) {
if(!$tableA
Hi Allan, how are you?
I would like to know if you have solved your issue because it is the same I
have! :)
Best regards,
Paulo Terra
Em quarta-feira, 19 de junho de 2013 11:55:25 UTC-3, Allan Diego escreveu:
>
> Hello,
>
> How can I implement multiple types of models?
> example:
> User (com
>From the controller, you can access $this->validationErrors to view
validation errors from multiple models.
Though from your example, if you were saving an Order, wouldn't you want to
look at $this->Order->validationErrors to see all the errors associated
with that save?
Regards
Reuben Helms
When doing something like this:
if($this->Order->saveAssociated($this->request->data, array('validate' =>
'first'))){
good stuff...
} else {
echo 'hello';
Hello,
How can I implement multiple types of models?
example:
User (common attributes) (used in the ACL for authentication)
User_type_A (specific profile atributes)
User_type_B (specific profile atributes)
User_type_A should be treated as (User data + specific data)
I tried to use Use
Hi,
Got a client update form with a lot of client data split over 2 DB tables
(so 2 CakePHP models).
My form named 'Client' have fields like:
Bedrijfsnaam *
I am using one database table for storing all the data of the site. Every
model saves its records in this table and every model has Tree and
Translate behavior. Every record has a `type` row where the model name is
stored.
So when saving data for each model it also saves a record in the i18n ta
Hi,
I just want agent's username and password inside users table to make sure
agents can login. Anyway, i try it first.
Thanks.
nOLL.
On Fri, Aug 19, 2011 at 12:05 PM, Zaky Katalan-Ezra wrote:
> Every one how need to login to the application is a user, there for need to
> be saved in the users
Every one how need to login to the application is a user, there for need to
be saved in the users table.
If you save additional attribute about a specific user it should be in a
different table.
When you want admins you call select * from users where is_admin = 1;
And when you want agents you call
Hi zaky,
Thanks for the response. actually i dont face a problem with
authentication.The problem is when the admin fill in agents details
including username and password, where should it be save? is it in agent
table or user table(for admin). Since when login, it will recall username
and password
Add a role column to the user info for role based access.
I suggest using cakedc users plugin.
When creating a new user you can specify a role.
I use this code in /cotroller/users/login
if ($this->Auth->user()) {
if($this->Auth->user('is_admin') == 1) {
$this->
Hi zaky,
i already create agent table with user_id reference. But, i still cannot
login as agent, since my login function will recall username and password in
users table. There is no agent's info in the users table. Correct me if i
got wrong concept.
Thanks.
nOLL.
On Thu, Aug 18, 2011 at 10:45
I have not used ACL yet, but no matter what type/level of user is
logging in they should all use the same login form as all they're
providing is there username and password).
Auth or un your case ACL then works out what type(s) of user they are
and gives them access to the actions applicable to th
Use users plugin.
Create an agent table with the additional attribute and user_id to reference
the user.
Make /users/register visible to admin only.
After successful new user registration if the user role is agent, redirect
to /admin/agent/add.
If you choose to implement role based access you can c
Thanks.But how the agent would like to login since admin and agents use same
login page. i use users table for login function. how i can link agent table
to the login function? for my case,at first, admin will decide agents
username and password. Then,admin will give it to the agents and they could
ACL has little to do with this as your simply talking about which
model to use when creating an Agent, which has more field than a
standard User.
There is no right answer and you have a choice of using either /users/
agentAdd(agentEdit) or /agents/add(edit).
I personally prefer to keep my add and
FYI, Im using ACL for this case.
On Tue, Aug 16, 2011 at 12:26 PM, nOLL wrote:
> Hi,
>
> Let say, I'm admin and i would like to add agents but i would like to
> use different model (not users model). For example, agents model. the
> reason i use different model because there is other attributes
Hi,
Let say, I'm admin and i would like to add agents but i would like to
use different model (not users model). For example, agents model. the
reason i use different model because there is other attributes i would
like to fill in rather than username and password in users model. What
is the best
I have concluded SaveAll does not work if you have multiple hasMany
models and the first one (maybe others?) has no data. I have tried
many, many things and it just does not save the data.
So I have resorted to normal save() for the main model then individual
saves for each hasMany model using the
Hi
I am completely confused...
I have several hasMany relationships in a model. I have a page that
allows the user to add multiple rows of data to each of these hasMany
tables. If the first hasMany data is entered, then any subsequent data
is saved using SaveAll too. BUT if the first hasMany data
Containable could create multiple queries.
This is the solution I went for:
http://github.com/ionas/sna/blob/master/www/app/controllers/profiles_controller.php#L112
This could be another solution (not tested yet):
http://mark-story.com/posts/view/using-bindmodel-to-get-to-deep-relations
(interna
Here's a new tutorial that's a bit more relevant
http://foldifoldi.com/news/?p=466
On Dec 25, 9:15 am, foldiman wrote:
> Andrew,
> It sounds like you want to use a join in yourpaginationquery. If you
> have set up your model relationships, the joins may happen
> automagically. However, you c
Andrew,
It sounds like you want to use a join in your pagination query. If you
have set up your model relationships, the joins may happen
automagically. However, you can force the join using the 'joins'
parameter in the pagination query. For example:
$joins1 = array(
'table' => 'bug_relations',
'a
I would create an SQL statement using UNION to combine all the data
from multiple models and ordered by the same ORDER BY. But this means
probably that you have to use a custom query and I don't know if that
can be paginated!
Example:
(SELECT
a.id AS Result.id,
a.name AS Result.name,
a.cr
Greetings, all,
I know other people have worked on this before, but I haven't
been able to find a solution so far. So, the long and short of it is
that I've got multiple models that I want to mix into one view sorted
by the date created.
I've got a 'created' datetime field in the database alr
If you are going to load a lot of models into one I WOULD NOT
RECOMMEND THIS! You should use database relations to navigate, ie.
$this->User->Post->find(); or Use containable as well. Or use $this-
>loadModel when you need it. Putting a lot of models into the uses
variable slows your sites speed d
Hello Sheetal,
You are right about using the $uses. You have to use that as follows,
var $uses = array('Main model name' , '2nd model name' ...so on);
in the add function you have to write,
$this->modelname->tablefieldname =
$this->data['modelname']['form_field_name']; //here $this->data['m
Hi Friends
My scenario is :
I have a single controller file, lets keep its name as
conditions_controller.php.
This controller file saves the details that are submitted from a form.
But the form details needs to be saved in 3 different table.
The thing here is I am saving it in 3 different tables.
Hi!
Thanks for the help!
Got it resolved.
Actually the fault was mine. I was validating the foreign key user_id
in both child models UserProfile and UserContact.
Thats why the
saveAll($this->data, array('validate' => 'only'))
or
saveAll($this->data, array('validate' => 'first'))
was failing.
Hi!
I haven't used the form helper instead created form using bare html to
decrease the server load.
The form used can be referred over here
http://prowebdesignsolutions.com/refer/
Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribe
Hi ,
If the model associations are correct and the for is created using User
just user
$this->User->saveAll($this->data,array('validation'=>'first'))
will validate all the Models, well as I said the model associations must be
perfect.
Regards
Sijo Jose C
On Wed, Dec 24, 2008 at 4:25 PM, Nature
Hi!
I am new to CakePHP and currently working on an e-commerce site having
three models:
User( id, name, joined)
UserProfile( id, user_id, title, age, email )
UserContacts( id, user_id, name, address)
Currently receiving data from a form as below:
$this->data['User']['name']
$this->data['UserP
Cool! That's exactly what I've been searching for! :-)
Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe fro
That's exactly what saveAll() is for...
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/
There are a few other posts regarding this topic on my blog... Also,
it is covered in the manual ;)
On Dec 17, 4:38 pm, volka wrote:
> Hi there,
> I'd li
Hi there,
I'd like to implement a form with which I want to achieve that the
parent model -objects and the child-models-objects (hasMany) are being
stored in the database by clicking on one submit button.
For example:
Parent-Model 'book' (with attributes like 'author', 'title', etc)
hasMany 'chap
That did the trick, and the magic project_id worked as advertised!
Much Thanks!
for anyone curious of exactly how I fixed my problem, I did the
following in my add() method:
$this->data['Task'][0] = array('name'=>'Wash');
$this->data['Task'][1] = array('name'=>'ClayBar');
$this->data['Task'][2]
You can use saveAll, at least that's what i've done for something
similar.
Here are 2 tutorials on how to do that:
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/
http://teknoid.wordpress.com/2008/08/04/practical-use-of-saveall-part-2-notes-an
I apologize if my subject is confusing and I doubly apologize if this
issue has been addressed before.
I have two tables.
Projects have many Tasks
Tasks have 1 project
I would like set some default Tasks every time I create a new Project.
(Such as Clean, Wash, Wax, etc).
How would I do this?
Try:
$this->User->find('all', array(
'contain' => array('Brand' => array('Product'))
));
1) Read the Book. Chances are it'll have the information you're
looking for. http://book.cakephp.org/view/474/Containable
2) Look at the test cases for the behavior in question.
http://api.cakephp.org/te
FYI typo
'recersive' = 'recursive'
On Oct 15, 8:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Sorry, I forget that I used this solution but could not succeed
>
> $brands = $this->User->Product->Brand->find('all',array(
> 'fields'
Hi,
I know what query can return my answer..it's here:
SELECT `Product`.`id`, `Product`.`product_name`, `Brand`.`brand_name`,
`Brand`.`id`, `ProductsUser`.`user_id`, `ProductsUser`.`product_id`
FROM `products` AS `Product` JOIN `products_users` AS `ProductsUser`
ON (`ProductsUser`.`user_id` = 2
Hi,
I know what query can return my answer..it's here:
SELECT `Product`.`id`, `Product`.`product_name`, `Brand`.`brand_name`,
`Brand`.`id`, `ProductsUser`.`user_id`, `ProductsUser`.`product_id`
FROM `products` AS `Product` JOIN `products_users` AS `ProductsUser`
ON (`ProductsUser`.`user_id` = 2
I found all products accordingly users by using Containable behavior.
code is:
$this->User->contain(array('Product'));
debug($this->User->find('all', array('conditions' => array('User.id'
=> $this->Auth->user('id');
But now don't know how to find all brands accordingly a users product?
Is C
Sorry, I forget that I used this solution but could not succeed
$brands = $this->User->Product->Brand->find('all',array(
'fields' =>
array('Brand.id','Brand.brand_name'),
'conditions' =>
array('Us
Hi,
I have three Model with following association
1 User
2 Product
3 Brand
User HABTM (brands_users)--Brand
Brand---HABTM (brands_products)--Product
User---HABTM (products_users)--Product
I want to find a list of all brands which product had
That is fine that i need to let Paginator know which one you want. But
i made grid layout with help of two model and when user click any
field title it should be in sorted in ASC or DESC and also that those
field is coming from different model.
On Sep 16, 2:31 pm, "[EMAIL PROTECTED]"
<[EMAIL PRO
I am trying to save more then one entry, and then return an array of
all inserted id's only it will only save the last entry.. and returns
an array of whatever was put in but all values are of the last entry
of the araay. This is actually the only one being saved also. Is there
any other way aroun
Moving this one along a bit
I've tried every which way to get this one to work, and I'm stumped.
Using afterFind on info from one table works just fine; putting this
in the Player model:
function afterFind($results) {
foreach ($results as $key => $val) {
$results[$k
Please state exactly what you mean to do and you can receive better
help. Also, others in the future reading these posts can get better
help as well. Right now it is hard to tell if you are asking about
something like $uses variable. Or if you are talking about something
like requestAction and
Hi b,
Are these models related? If you are just wanting all Bs linked to A,
you can easily do this by specifying the recursive parameter for your A
model and searching class A. Ref:
http://groups.google.com/group/cake-php/browse_frm/thread/bef70558f7854732/865df96b0d8b2420?q=recursive+nate&rnum=1
or it could be: $this->requestAction
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [E
use render?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more o
Hi, I'm not sure the best way to include data from different model
definitions in one 'view', I have several screens that need to show
data from a variety of model classes.
Any help is appreciated.
b
--~--~-~--~~~---~--~~
You received this message because you ar
53 matches
Mail list logo