Yii model to array?

I’m going on the assumption here that you only need to retrieve just the bare arrays, and not any associated model objects. This will do it: $model = Trips::model(); $trips = $model->getCommandBuilder() ->createFindCommand($model->tableSchema, $model->dbCriteria) ->queryAll(); This is like the Yii::app()->db->createCommand(‘SELECT * FROM tbl’)->queryAll(); examples, except: It’ll ask the model for the table name; you won’t … Read more

How do I validate that two values do not equal each other in a Rails model?

Create custom validataion: validate :check_email_and_password def check_email_and_password errors.add(:password, “can’t be the same as email”) if email == password end But keep in mind that storing password as a plain text is bad idea. You should store it hashed. Try some authentication plugin like authlogic or Restful authentication.

Share types between client and server

You can use TypeScript path mapping. Example from a project I’m the author of: Backend defined types inside SampleTypes.ts are reused in the client project to avoid duplicating the code. client/tsconfig.json: { “compilerOptions”: { “paths”: { “@backend/*”: [“../server/src/api/*”], }, } } ../server/src/api/ -> https://github.com/winwiz1/crisp-react/tree/master/server/src/api client/….ts: import { SampleRequest } from “@backend/types/SampleTypes”;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)